Page 1 of 1

HTML to DITA conversion using the built-in h2d plugin

Posted: Wed May 25, 2016 7:50 pm
by surangamas
Hi:
I am trying to get this to work, but don't know what was missing in the process. I was following the instruction here: http://idratherbewriting.com/md2html2ditav2/ to automate conversion of Markdown files to HTML and ultimately to DITA, and I had written a script based on the tutorial in the URL, here is the script (I named it "ditaqrg.sh"):

Code: Select all

multimarkdown -f -b *.md
cd /Applications/oxygenAuthor/frameworks/dita/DITA-OT/plugins/h2d ant -Dargs.input=/Users/%user_name%/projects/ditaqrg -Dargs.output=/Users/%user_name%/projects/ditaqrg
cd /Users/%user_name%/projects/ditaqrg
As you can see, this script points to the Oxygen installation directory and to the h2d subdirectory. Supposedly if your script points to the h2d subdirectory, Oxygen should automatically fire up the ant script to process the conversion of html files to DITA, but unfortunately, the process stopped after I ran ./ditaqrg.sh in the Terminal screen. Although an HTML file was successfully produced, yet the script failed to further generate a DITA file from the HTML. I know I could just simply copy contents from the HTML to Oxygen's editor screen, but I would very much love this process to be automatic, given that I have quite a few Markdown files that I want to batch-process all at once.

Could you point out the error in the script? Or is there something I missed in the process? Thanks.

Re: HTML to DITA conversion using the built-in h2d plugin

Posted: Thu May 26, 2016 10:42 am
by Radu
Hi,

This processing is not related to Oxygen in any way, indeed the DITA OT bundled with Oxygen comes bundled with this h2d plugin which can be used to convert XHTML files to DITA but you can also have an external DITA OT with the same plugin installed.
Ideally you would open in Oxygen the build file:

OXYGEN_INSTALL_DIR\frameworks\dita\DITA-OT\plugins\h2d\build.xml

and get a little bit familiar with what it does. Indeed its main parameters seem to be args.input which can point to a folder and args.output which can also point to the output folder. But it also seems to need a parameter called temp.dir which should point to a folder which is already created on disk, folder in which the temporary conversion results will be saved. So you should also try to send this parameter when starting the ant process.
Also the build file has some file patterns that it uses to identify HTML documents based on the extension. Maybe the extensions of the HTML documents generated in the first stage do not match.
You can also add <echo> tags in the build file and output debug information in the console.

Regards,
Radu

Re: HTML to DITA conversion using the built-in h2d plugin

Posted: Thu May 26, 2016 6:20 pm
by surangamas
Hi Radu:
OK, I'll give that a try, thank you.