build_general_template.xml 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. This file is part of the DITA Open Toolkit project.
  4. Copyright 2006 IBM Corporation
  5. See the accompanying LICENSE file for applicable license.
  6. -->
  7. <project xmlns:dita="http://dita-ot.sourceforge.net"
  8. xmlns:if="ant:if"
  9. xmlns:unless="ant:unless"
  10. name="build_generaltargets">
  11. <target name="xhtml.init">
  12. <dita-ot-fail id="DOTA007E">
  13. <condition>
  14. <and>
  15. <isset property="args.ftr" />
  16. <not>
  17. <available file="${args.ftr}" type="file"/>
  18. </not>
  19. </and>
  20. </condition>
  21. <param name="1" value="${args.ftr}"/>
  22. </dita-ot-fail>
  23. <dita-ot-fail id="DOTA008E">
  24. <condition>
  25. <and>
  26. <isset property="args.hdr" />
  27. <not>
  28. <available file="${args.hdr}" type="file"/>
  29. </not>
  30. </and>
  31. </condition>
  32. <param name="1" value="${args.hdr}"/>
  33. </dita-ot-fail>
  34. <dita-ot-fail id="DOTA009E">
  35. <condition>
  36. <and>
  37. <isset property="args.hdf" />
  38. <not>
  39. <available file="${args.hdf}" type="file"/>
  40. </not>
  41. </and>
  42. </condition>
  43. <param name="1" value="${args.hdf}"/>
  44. </dita-ot-fail>
  45. <!-- begin to check and init css relevant properties -->
  46. <condition property="user.csspath.url">
  47. <or>
  48. <contains string="${args.csspath}" substring="http://" />
  49. <contains string="${args.csspath}" substring="https://" />
  50. </or>
  51. </condition>
  52. <condition property="args.csspath.absolute">
  53. <isabsolute path="${args.csspath}" />
  54. </condition>
  55. <!-- Set the csspath as default empty directory when there is no user
  56. input csspath or user input csspath is a local absolute path. -->
  57. <condition property="user.csspath" value="">
  58. <or>
  59. <not>
  60. <isset property="args.csspath" />
  61. </not>
  62. <isset property="args.csspath.absolute" />
  63. </or>
  64. </condition>
  65. <condition property="user.csspath" value="${args.csspath}/">
  66. <not>
  67. <isset property="user.csspath" />
  68. </not>
  69. </condition>
  70. <condition property="args.css.real" value="${args.cssroot}${file.separator}${args.css}">
  71. <isset property="args.cssroot" />
  72. </condition>
  73. <condition property="args.css.real" value="${args.css}">
  74. <not>
  75. <isset property="args.cssroot" />
  76. </not>
  77. </condition>
  78. <available file="${args.css.real}" property="args.css.present" type="file" />
  79. <basename property="args.css.file.temp" file="${args.css}" />
  80. <condition property="args.css.file" value="${args.css.file.temp}">
  81. <or>
  82. <isset property="args.css.present" />
  83. <isset property="user.csspath.url" />
  84. </or>
  85. </condition>
  86. <!-- end to check and init css relevant parameters -->
  87. <condition property="out.ext" value=".html">
  88. <not>
  89. <isset property="out.ext" />
  90. </not>
  91. </condition>
  92. <condition property="html-version" value="xhtml">
  93. <not>
  94. <isset property="html-version"/>
  95. </not>
  96. </condition>
  97. <condition property="args.xsl" value="${dita.plugin.org.dita.xhtml.dir}/xsl/dita2${html-version}.xsl">
  98. <not>
  99. <isset property="args.xsl" />
  100. </not>
  101. </condition>
  102. <makeurl file="${dita.input.valfile}" property="dita.input.valfile.url" validate="no"/>
  103. <!-- Set to "true" if you get out-of-memory errors during preprocess
  104. while processing very large (thousands of files) document sets. -->
  105. <condition property="dita.xhtml.reloadstylesheet" value="false">
  106. <not><isset property="dita.xhtml.reloadstylesheet"/></not>
  107. </condition>
  108. <antcall target="output-css-warn-message"/>
  109. </target>
  110. <target name="output-css-warn-message" if="args.csspath.absolute">
  111. <dita-ot-echo id="DOTA006W" />
  112. </target>
  113. <target name="xhtml.topics"
  114. depends="xhtml.init,
  115. xhtml.image-metadata,
  116. dita.topics.html.common,
  117. dita.inner.topics.html.common"/>
  118. <target name="xhtml.image-metadata"
  119. unless="xhtml.image-metadata.skip"
  120. description="Read image metadata">
  121. <pipeline message="Read image metadata." taskname="image-metadata">
  122. <module class="org.dita.dost.module.ImageMetadataModule">
  123. <param name="outputdir" location="${dita.output.dir}"/>
  124. </module>
  125. </pipeline>
  126. </target>
  127. <!--requirement 3, old solution-->
  128. <macrodef name="topics.html">
  129. <element name="params" optional="true" implicit="true"/>
  130. <sequential>
  131. <pipeline>
  132. <xslt basedir="${dita.temp.dir}"
  133. destdir="${dita.output.dir}"
  134. reloadstylesheet="${dita.xhtml.reloadstylesheet}"
  135. extension="${out.ext}" style="${args.xsl}"
  136. filenameparameter="FILENAME"
  137. filedirparameter="FILEDIR">
  138. <ditafileset format="dita" processingRole="normal"/>
  139. <param name="TRANSTYPE" expression="${transtype}" />
  140. <param name="FILTERFILE" expression="${dita.input.valfile.url}"
  141. if:set="dita.input.valfile" />
  142. <param name="CSS" expression="${args.css.file}"
  143. if:set="args.css.file" />
  144. <param name="CSSPATH" expression="${user.csspath}"
  145. if:set="user.csspath" />
  146. <param name="HDF" expression="${args.hdf}" if:set="args.hdf" />
  147. <param name="HDR" expression="${args.hdr}" if:set="args.hdr" />
  148. <param name="FTR" expression="${args.ftr}" if:set="args.ftr" />
  149. <param name="DRAFT" expression="${args.draft}" if:set="args.draft" />
  150. <param name="ARTLBL" expression="${args.artlbl}" if:set="args.artlbl" />
  151. <param name="GENERATE-TASK-LABELS" expression="${args.gen.task.lbl}" if:set="args.gen.task.lbl" />
  152. <param name="PRESERVE-DITA-CLASS" expression="${args.xhtml.classattr}" if:set="args.xhtml.classattr"/>
  153. <param name="NOPARENTLINK" expression="${args.hide.parent.link}" if:set="args.hide.parent.link"/>
  154. <param name="include.rellinks" expression="${include.rellinks}"/>
  155. <param name="INDEXSHOW" expression="${args.indexshow}" if:set="args.indexshow" />
  156. <param name="genDefMeta" expression="${args.gen.default.meta}" if:set="args.gen.default.meta" />
  157. <param name="OUTEXT" expression="${out.ext}" if:set="out.ext" />
  158. <param name="BASEDIR" expression="${dita.dir}"/>
  159. <param name="OUTPUTDIR" expression="${dita.output.dir}"/>
  160. <param name="DBG" expression="${args.debug}" if:set="args.debug"/>
  161. <param name="defaultLanguage" expression="${default.language}"/>
  162. <params/>
  163. <xmlcatalog refid="dita.catalog"/>
  164. </xslt>
  165. </pipeline>
  166. </sequential>
  167. </macrodef>
  168. <target name="dita.topics.html.common" unless="noTopic" if="old.transform">
  169. <topics.html>
  170. <dita:extension id="dita.conductor.xhtml.param" behavior="org.dita.dost.platform.InsertAction"/>
  171. <dita:extension id="dita.conductor.html.param" behavior="org.dita.dost.platform.InsertAction"/>
  172. <mapper classname="org.dita.dost.ant.types.JobMapper" to="${out.ext}"/>
  173. </topics.html>
  174. </target>
  175. <!--To generate&copy inner files-->
  176. <!--requirement 1,2-->
  177. <target name="dita.inner.topics.html.common" unless="noTopic" if="inner.transform">
  178. <topics.html>
  179. <dita:extension id="dita.conductor.xhtml.param" behavior="org.dita.dost.platform.InsertAction"/>
  180. <dita:extension id="dita.conductor.html.param" behavior="org.dita.dost.platform.InsertAction"/>
  181. <mapper classname="org.dita.dost.ant.types.JobMapper" to="${out.ext}"/>
  182. </topics.html>
  183. </target>
  184. </project>