1 | <?xml version="1.0"?>
|
---|
2 | <!--
|
---|
3 | This file is part of the DITA Open Toolkit project.
|
---|
4 | See the accompanying license.txt file for applicable licenses.
|
---|
5 | -->
|
---|
6 | <project name="org.dita.pdf2.axf">
|
---|
7 |
|
---|
8 | <target name="transform.fo2pdf.ah.test-use">
|
---|
9 | <condition property="use.ah.pdf.formatter">
|
---|
10 | <equals arg1="${pdf.formatter}" arg2="ah"/>
|
---|
11 | </condition>
|
---|
12 | </target>
|
---|
13 |
|
---|
14 | <target name="transform.fo2pdf.ah.init" if="use.ah.pdf.formatter">
|
---|
15 | <!-- default output format -->
|
---|
16 | <condition property="axf.formatter.output-format" value="@PDF">
|
---|
17 | <not><isset property="axf.formatter.output-format"/></not>
|
---|
18 | </condition>
|
---|
19 | <!-- output file extension -->
|
---|
20 | <condition property="xsl.formatter.ext" value=".ps">
|
---|
21 | <and>
|
---|
22 | <equals arg1="${axf.formatter.output-format}" arg2="@PS"/>
|
---|
23 | <not><isset property="xsl.formatter.ext"/></not>
|
---|
24 | </and>
|
---|
25 | </condition>
|
---|
26 | <condition property="xsl.formatter.ext" value=".txt">
|
---|
27 | <and>
|
---|
28 | <equals arg1="${axf.formatter.output-format}" arg2="@TEXT"/>
|
---|
29 | <not><isset property="xsl.formatter.ext"/></not>
|
---|
30 | </and>
|
---|
31 | </condition>
|
---|
32 | <condition property="xsl.formatter.ext" value=".inx">
|
---|
33 | <and>
|
---|
34 | <equals arg1="${axf.formatter.output-format}" arg2="@INX"/>
|
---|
35 | <not><isset property="xsl.formatter.ext"/></not>
|
---|
36 | </and>
|
---|
37 | </condition>
|
---|
38 | <condition property="xsl.formatter.ext" value=".svg">
|
---|
39 | <and>
|
---|
40 | <equals arg1="${axf.formatter.output-format}" arg2="@SVG"/>
|
---|
41 | <not><isset property="xsl.formatter.ext"/></not>
|
---|
42 | </and>
|
---|
43 | </condition>
|
---|
44 | <condition property="xsl.formatter.ext" value=".mda">
|
---|
45 | <and>
|
---|
46 | <equals arg1="${axf.formatter.output-format}" arg2="@MODCA"/>
|
---|
47 | <not><isset property="xsl.formatter.ext"/></not>
|
---|
48 | </and>
|
---|
49 | </condition>
|
---|
50 | <condition property="xsl.formatter.ext" value=".mif">
|
---|
51 | <and>
|
---|
52 | <equals arg1="${axf.formatter.output-format}" arg2="@MIF"/>
|
---|
53 | <not><isset property="xsl.formatter.ext"/></not>
|
---|
54 | </and>
|
---|
55 | </condition>
|
---|
56 | <condition property="xsl.formatter.ext" value=".AT.xml">
|
---|
57 | <and>
|
---|
58 | <equals arg1="${axf.formatter.output-format}" arg2="@AreaTree"/>
|
---|
59 | <not><isset property="xsl.formatter.ext"/></not>
|
---|
60 | </and>
|
---|
61 | </condition>
|
---|
62 | <condition property="xsl.formatter.ext" value=".xps">
|
---|
63 | <and>
|
---|
64 | <equals arg1="${axf.formatter.output-format}" arg2="@XPS"/>
|
---|
65 | <not><isset property="xsl.formatter.ext"/></not>
|
---|
66 | </and>
|
---|
67 | </condition>
|
---|
68 | <condition property="xsl.formatter.ext" value=".pdf">
|
---|
69 | <and>
|
---|
70 | <equals arg1="${axf.formatter.output-format}" arg2="@PDF"/>
|
---|
71 | <not><isset property="xsl.formatter.ext"/></not>
|
---|
72 | </and>
|
---|
73 | </condition>
|
---|
74 | </target>
|
---|
75 |
|
---|
76 | <!--Set up and run Antenna House-->
|
---|
77 | <target name="transform.fo2pdf.ah" depends="transform.fo2pdf.ah.test-use, transform.fo2pdf.ah.init" if="use.ah.pdf.formatter">
|
---|
78 | <condition property="has.axf.option">
|
---|
79 | <and>
|
---|
80 | <not><equals arg1="${env.AXF_OPT}" arg2=""/></not>
|
---|
81 | <available file="${env.AXF_OPT}"/>
|
---|
82 | </and>
|
---|
83 | </condition>
|
---|
84 |
|
---|
85 | <condition property="axf.path" value="${env.AXF_DIR}">
|
---|
86 | <and>
|
---|
87 | <isset property="env.AXF_DIR"/>
|
---|
88 | <or>
|
---|
89 | <available file="${env.AXF_DIR}/run.sh"/>
|
---|
90 | <available file="${env.AXF_DIR}/XSLCmd.exe"/>
|
---|
91 | <available file="${env.AXF_DIR}/AHFCmd.exe"/>
|
---|
92 | </or>
|
---|
93 | </and>
|
---|
94 | </condition>
|
---|
95 |
|
---|
96 | <!-- run.sh on Linux, AHFCmd.exe or XSLCmd.exe on Windows -->
|
---|
97 | <condition property="fo.ah.program.name" value="run.sh">
|
---|
98 | <and>
|
---|
99 | <not><isset property="fo.ah.program.name"/></not>
|
---|
100 | <os family="unix"/>
|
---|
101 | <isset property="axf.path"/>
|
---|
102 | <available file="${axf.path}/run.sh"/>
|
---|
103 | </and>
|
---|
104 | </condition>
|
---|
105 | <condition property="fo.ah.program.name" value="AHFCmd.exe">
|
---|
106 | <and>
|
---|
107 | <not><isset property="fo.ah.program.name"/></not>
|
---|
108 | <isset property="axf.path"/>
|
---|
109 | <available file="${axf.path}/AHFCmd.exe"/>
|
---|
110 | </and>
|
---|
111 | </condition>
|
---|
112 | <condition property="fo.ah.program.name" value="XSLCmd.exe">
|
---|
113 | <and>
|
---|
114 | <not><isset property="fo.ah.program.name"/></not>
|
---|
115 | <isset property="axf.path"/>
|
---|
116 | <available file="${axf.path}/XSLCmd.exe"/>
|
---|
117 | </and>
|
---|
118 | </condition>
|
---|
119 |
|
---|
120 | <condition property="axf.cmd" value="${axf.path}/${fo.ah.program.name}">
|
---|
121 | <and>
|
---|
122 | <not><isset property="axf.cmd"/></not>
|
---|
123 | <isset property="axf.path"/>
|
---|
124 | <isset property="fo.ah.program.name"/>
|
---|
125 | </and>
|
---|
126 | </condition>
|
---|
127 | <!-- Fall back to brute force search -->
|
---|
128 | <pathconvert property="axf.cmd" setonempty="false">
|
---|
129 | <first>
|
---|
130 | <union>
|
---|
131 | <fileset dir="/Applications" includes="AntennaHouse/run.sh" erroronmissingdir="false"/>
|
---|
132 | <fileset dir="/usr" includes="AHFormatterV*/run.sh" erroronmissingdir="false"/>
|
---|
133 | <fileset dir="/usr" includes="XSLFormatterV*/run.sh" erroronmissingdir="false"/>
|
---|
134 | <fileset dir="C:\Program Files\AntennaHouse" erroronmissingdir="false">
|
---|
135 | <include name="AHFormatterV*\AHFCmd.exe"/>
|
---|
136 | <include name="XSLFormatterV*\XSLCmd.exe"/>
|
---|
137 | </fileset>
|
---|
138 | <fileset dir="C:\Program Files\Antenna" erroronmissingdir="false">
|
---|
139 | <include name="AHFormatterV*\AHFCmd.exe"/>
|
---|
140 | <include name="XSLFormatterV*\XSLCmd.exe"/>
|
---|
141 | </fileset>
|
---|
142 | <fileset dir="C:\Program Files (x86)\AntennaHouse" erroronmissingdir="false">
|
---|
143 | <include name="AHFormatterV*\AHFCmd.exe"/>
|
---|
144 | <include name="XSLFormatterV*\XSLCmd.exe"/>
|
---|
145 | </fileset>
|
---|
146 | <fileset dir="C:\Program Files (x86)\Antenna" erroronmissingdir="false">
|
---|
147 | <include name="AHFormatterV*\AHFCmd.exe"/>
|
---|
148 | <include name="XSLFormatterV*\XSLCmd.exe"/>
|
---|
149 | </fileset>
|
---|
150 | </union>
|
---|
151 | </first>
|
---|
152 | </pathconvert>
|
---|
153 |
|
---|
154 | <fail message="Unable to locate AXF, set property axf.path or axf.cmd">
|
---|
155 | <condition>
|
---|
156 | <not>
|
---|
157 | <and>
|
---|
158 | <isset property="axf.cmd"/>
|
---|
159 | <available file="${axf.cmd}" type="file"/>
|
---|
160 | </and>
|
---|
161 | </not>
|
---|
162 | </condition>
|
---|
163 | </fail>
|
---|
164 |
|
---|
165 | <condition property="outputFile" value="${dita.map.output.dir}/${outputFile.base}${xsl.formatter.ext}">
|
---|
166 | <not><isset property="outputFile"/></not>
|
---|
167 | </condition>
|
---|
168 | <mkdir dir="${dita.map.output.dir}"/>
|
---|
169 |
|
---|
170 | <antcall target="transform.fo2pdf.ah.nooption"/>
|
---|
171 | <antcall target="transform.fo2pdf.ah.hasoption"/>
|
---|
172 | </target>
|
---|
173 |
|
---|
174 | <target name="transform.fo2pdf.ah.nooption" unless="has.axf.option">
|
---|
175 | <exec executable="${axf.cmd}" resultproperty="errCode" logerror="true">
|
---|
176 | <arg value="-d"/>
|
---|
177 | <arg value="${pdf2.temp.dir}/topic.fo"/>
|
---|
178 | <arg value="-o"/>
|
---|
179 | <arg value="${outputFile}"/>
|
---|
180 | <arg value="-p"/>
|
---|
181 | <arg value="${axf.formatter.output-format}"/>
|
---|
182 | <arg value="-extlevel"/>
|
---|
183 | <arg value="4"/>
|
---|
184 | <arg value="-peb"/>
|
---|
185 | <arg value="1"/>
|
---|
186 | </exec>
|
---|
187 | </target>
|
---|
188 |
|
---|
189 | <target name="transform.fo2pdf.ah.hasoption" if="has.axf.option">
|
---|
190 | <exec executable="${axf.cmd}" resultproperty="errCode" logerror="true">
|
---|
191 | <arg value="-d"/>
|
---|
192 | <arg value="${pdf2.temp.dir}/topic.fo"/>
|
---|
193 | <arg value="-o"/>
|
---|
194 | <arg value="${outputFile}"/>
|
---|
195 | <arg value="-p"/>
|
---|
196 | <arg value="${axf.formatter.output-format}"/>
|
---|
197 | <arg value="-extlevel"/>
|
---|
198 | <arg value="4"/>
|
---|
199 | <arg value="-peb"/>
|
---|
200 | <arg value="1"/>
|
---|
201 | <arg value="-i"/>
|
---|
202 | <arg value="${env.AXF_OPT}"/>
|
---|
203 | </exec>
|
---|
204 | </target>
|
---|
205 |
|
---|
206 | </project>
|
---|