dita-ot icon indicating copy to clipboard operation
dita-ot copied to clipboard

file: URL for args.input results in bad value for args.input

Open ekimbernow opened this issue 3 years ago • 3 comments

Expected Behavior

When using -i or <context> in a project file, the value of args.input is generally usable as the basis for any Ant processing.

Actual Behavior

The value of args.input treats the input value as a path relative to the location where the dita command is run from, i.e.:

 [echo] args.input=file\:/Users/eliot.kimber/git/utah/doc/source/bundle-appportman-application-portfolio-management.ditamap

And then when used in a normal (non-pipeline) Ant task:

com.servicenow.keyification.do-mapref-swapping:
     [echo] [INFO] Swapping out peer maprefs in map "file:/Users/eliot.kimber/git/utah/doc/source/bundle-appportman-application-portfolio-management.ditamap"
     [echo] [DEBUG] input.dir="/Users/eliot.kimber/git/dita-build-tools/ditaot/ditaot-keyification/file:/Users/eliot.kimber/git/utah/doc/source"

Where input.dir is constructed like so:

<dirname file="${args.input}" property="input.dir"/>

Which demonstrates that the value of args.input is not the URL "file:/..." but the path /Users/eliot.kimber/git/dita-build-tools/ditaot/ditaot-keyification/file:/Users/eliot.kimber/git/utah/doc/source

Possible Solution

None identified: I have been unable to find a general Ant solution that makes the initial value of args.input usable outside of a pipeline context.

Steps to Reproduce

  1. Run dita command using -i file:/..../ form with -v
  2. Observe reported value of args.input

Copy of the error message, log file or stack trace

From this invocation:

~/git/dita-build-tools/ditaot/ditaot-keyification/bin/dita -i "file:/Users/eliot.kimber/git/utah/doc/source/bundle-appportman-application-portfolio-management.ditamap" -f xhtml -o ~/git/out  -v

Get this result in the log:

 [echo] args.input=file\:/Users/eliot.kimber/git/utah/doc/source/bundle-appportman-application-portfolio-management.ditamap

Environment

  • DITA-OT version: 3.7.4
  • Operating system and version: macOS Monterey
  • How did you run DITA-OT? dita command
  • Transformation type: Not relevant.

ekimbernow avatar Apr 13 '23 14:04 ekimbernow

I am able to create a new property that removes any leading "file:" from args.input but this shouldn't be necessary:

<loadresource property="input.file.path">
      <propertyresource name="args.input"/>
      <filterchain>
        <tokenfilter>
          <replacestring from="file:" to=""/>
        </tokenfilter>
      </filterchain>
    </loadresource>
    <echo>[DEBUG] input.file.path="${input.file.path}"</echo>

ekimbernow avatar Apr 13 '23 14:04 ekimbernow

Can't reproduce this with develop branch code. If I use e.g. -i file:/Volumes/tmp/src/root.ditamap, process runs without error just like with -i /Volumes/tmp/src/root.ditamap

jelovirt avatar Apr 14 '23 13:04 jelovirt

URL file specifications work for me too, either with the -i option or in a DITA-OT project file.

chrispy-snps avatar Apr 15 '23 12:04 chrispy-snps