build_general_template.xml 8.1 KB

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