Creating an Ant build script
Instead of typing the DITA-OT parameters at the command prompt, you might want to create an Ant build script that contains all of the parameters.
Procedure
Example
The following Ant build script generates CHM and PDF output for the sample DITA
maps.
<?xml version="1.0" encoding="UTF-8" ?>
<project name="build-chm-pdf" default="all" basedir=".">
<property name="dita.dir" location="${basedir}/../../.."/>
<target name="all" description="build CHM and PDF" depends="chm,pdf"/>
<target name="chm" description="build CHM">
<ant antfile="${dita.dir}/build.xml">
<property name="args.input" location="../sequence.ditamap"/>
<property name="transtype" value="htmlhelp"/>
<property name="output.dir" location="../out/chm"/>
<property name="args.gen.task.lbl" value="YES"/>
<property name="args.breadcrumbs" value="yes"/>
</ant>
</target>
<target name="pdf" description="build PDF">
<ant antfile="${dita.dir}/build.xml">
<property name="args.input" location="../taskbook.ditamap"/>
<property name="transtype" value="pdf"/>
<property name="output.dir" location="../out/pdf"/>
<property name="args.gen.task.lbl" value="YES"/>
<property name="args.rellinks" value="nofamily"/>
</ant>
</target>
</project>
In addition to the mandatory parameters (args.input and transtype),
the chm and pdf targets each specify some optional parameters:
- The args.gen.task.lbl property is set to YES, which ensures that headings are automatically generated for the sections of task topics.
- The output.dir property specifies where the DITA-OT writes the output of the transformations.
The pdf target also specifies that related links should be generated in the PDF, but only
those links that are created by relationship tables and <link>
elements.
Finally, the all target simply specifies that both the chm and pdf target should be run.