build_dita2htmlhelp.xml 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- This file is part of the DITA Open Toolkit project.
  3. See the accompanying license.txt file for applicable licenses.-->
  4. <!-- (c) Copyright IBM Corp. 2006 All Rights Reserved. -->
  5. <project name="dita2htmlhelp">
  6. <target name="dita2htmlhelp" unless="noMap"
  7. depends="dita2htmlhelp.init,
  8. build-init,
  9. use-init.envhhcdir,
  10. use-init.hhcdir,
  11. preprocess,
  12. xhtml.topics,
  13. copy-css">
  14. <antcall target="dita.map.htmlhelp"/>
  15. <antcall target="dita.htmlhelp.convertlang"/>
  16. <antcall target="compile.HTML.Help"/>
  17. </target>
  18. <target name="dita2htmlhelp.init">
  19. <property name="html-version" value="html"/>
  20. </target>
  21. <target name="use-init.envhhcdir" if="env.HHCDIR">
  22. <available file="${env.HHCDIR}/hhc.exe"
  23. property="HTMLHelpCompiler"
  24. value="${env.HHCDIR}${file.separator}hhc.exe"/>
  25. </target>
  26. <target name="use-init.hhcdir" unless="env.HHCDIR">
  27. <condition property="hhc.dir"
  28. value="${env.ProgramFiles(x86)}\HTML Help Workshop"
  29. else="${env.ProgramFiles}\HTML Help Workshop">
  30. <available file="${env.ProgramFiles(x86)}\HTML Help Workshop" type="dir"/>
  31. </condition>
  32. <available file="${hhc.dir}/hhc.exe"
  33. property="HTMLHelpCompiler"
  34. value="${hhc.dir}${file.separator}hhc.exe"/>
  35. </target>
  36. <target name="dita.map.htmlhelp"
  37. depends="dita.map.htmlhelp.init,
  38. dita.map.htmlhelp.hhp,
  39. dita.map.htmlhelp.hhc,
  40. dita.map.htmlhelp.hhk"/>
  41. <target name="dita.map.htmlhelp.init" description="Init properties for HTMLHelp">
  42. <condition property="out.ext" value=".html">
  43. <not>
  44. <isset property="out.ext"/>
  45. </not>
  46. </condition>
  47. </target>
  48. <target name="dita.map.htmlhelp.hhp" depends="dita.map.htmlhelp.init"
  49. description="Build HTMLHelp HHP file">
  50. <local name="htmlhelp.hhp.output.dir"/>
  51. <condition property="htmlhelp.hhp.output.dir" value="${output.dir}" else="${_dita.map.output.dir}">
  52. <isset property="inner.transform"/>
  53. </condition>
  54. <xslt basedir="${dita.temp.dir}"
  55. destdir="${htmlhelp.hhp.output.dir}"
  56. includesfile="${dita.temp.dir}/${user.input.file.listfile}"
  57. classpathref="dost.class.path"
  58. style="${dita.plugin.org.dita.htmlhelp.dir}/xsl/map2hhp.xsl">
  59. <excludesfile name="${dita.temp.dir}/${resourceonlyfile}" if="resourceonlyfile"/>
  60. <param name="OUTEXT" expression="${out.ext}" if="out.ext"/>
  61. <param name="HHCNAME" expression="${dita.map.filename.root}.hhc"/>
  62. <param name="INCLUDEFILE" expression="${args.htmlhelp.includefile}" if="args.htmlhelp.includefile"/>
  63. <param name="defaultLanguage" expression="${default.language}"/>
  64. <xmlcatalog refid="dita.catalog"/>
  65. <mergemapper to="${dita.map.filename.root}.hhp"/>
  66. </xslt>
  67. </target>
  68. <!-- Deprecated since 2.1 -->
  69. <target name="dita.out.map.htmlhelp.hhp" depends="dita.map.htmlhelp.init" if="inner.transform"
  70. description="Build HTMLHelp HHP file">
  71. <dita-ot-echo id="DOTX070W"><param name="1" value="dita.out.map.htmlhelp.hhp"/></dita-ot-echo>
  72. <xslt basedir="${dita.temp.dir}"
  73. destdir="${output.dir}"
  74. includesfile="${dita.temp.dir}/${user.input.file.listfile}"
  75. classpathref="dost.class.path"
  76. style="${dita.plugin.org.dita.htmlhelp.dir}/xsl/map2hhp.xsl">
  77. <excludesfile name="${dita.temp.dir}/${resourceonlyfile}" if="resourceonlyfile"/>
  78. <param name="OUTEXT" expression="${out.ext}" if="out.ext"/>
  79. <param name="HHCNAME" expression="${dita.map.filename.root}.hhc"/>
  80. <param name="INCLUDEFILE" expression="${args.htmlhelp.includefile}" if="args.htmlhelp.includefile"/>
  81. <mapper type="glob" from="${user.input.file}" to="${dita.map.filename.root}.hhp"/>
  82. <xmlcatalog refid="dita.catalog"/>
  83. </xslt>
  84. </target>
  85. <target name="dita.map.htmlhelp.hhc" depends="dita.map.htmlhelp.init"
  86. description="Build HTMLHelp HHC file">
  87. <local name="htmlhelp.hhc.output.dir"/>
  88. <condition property="htmlhelp.hhc.output.dir" value="${output.dir}" else="${_dita.map.output.dir}">
  89. <isset property="inner.transform"/>
  90. </condition>
  91. <xslt basedir="${dita.temp.dir}"
  92. destdir="${htmlhelp.hhc.output.dir}"
  93. includesfile="${dita.temp.dir}/${user.input.file.listfile}"
  94. classpathref="dost.class.path"
  95. style="${dita.plugin.org.dita.htmlhelp.dir}/xsl/map2hhc.xsl">
  96. <excludesfile name="${dita.temp.dir}/${resourceonlyfile}" if="resourceonlyfile"/>
  97. <param name="OUTEXT" expression="${out.ext}" if="out.ext"/>
  98. <param name="defaultLanguage" expression="${default.language}"/>
  99. <xmlcatalog refid="dita.catalog"/>
  100. <mergemapper to="${dita.map.filename.root}.hhc"/>
  101. </xslt>
  102. </target>
  103. <!-- Deprecated since 2.1 -->
  104. <target name="dita.out.map.htmlhelp.hhc" depends="dita.map.htmlhelp.init" if="inner.transform"
  105. description="Build HTMLHelp HHC file">
  106. <dita-ot-echo id="DOTX070W"><param name="1" value="dita.out.map.htmlhelp.hhc"/></dita-ot-echo>
  107. <xslt basedir="${dita.temp.dir}"
  108. destdir="${output.dir}"
  109. includesfile="${dita.temp.dir}/${user.input.file.listfile}"
  110. classpathref="dost.class.path"
  111. style="${dita.plugin.org.dita.htmlhelp.dir}/xsl/map2hhc.xsl">
  112. <excludesfile name="${dita.temp.dir}/${resourceonlyfile}" if="resourceonlyfile"/>
  113. <param name="OUTEXT" expression="${out.ext}" if="out.ext"/>
  114. <mapper type="glob" from="${user.input.file}" to="${dita.map.filename.root}.hhc"/>
  115. <xmlcatalog refid="dita.catalog"/>
  116. </xslt>
  117. </target>
  118. <target name="dita.map.htmlhelp.hhk" depends="dita.map.htmlhelp.init"
  119. description="Build HTMLHelp HHK file">
  120. <local name="htmlhelp.hhk.output.dir"/>
  121. <condition property="htmlhelp.hhk.output.dir" value="${output.dir}" else="${_dita.map.output.dir}">
  122. <isset property="inner.transform"/>
  123. </condition>
  124. <pipeline message="Extract index term." tempdir="${dita.temp.dir}" inputmap="${user.input.file}">
  125. <module class="org.dita.dost.module.IndexTermExtractModule">
  126. <param name="output" location="${htmlhelp.hhk.output.dir}/${dita.map.filename.root}.hhk"/>
  127. <param name="targetext" value="${out.ext}"/>
  128. <param name="indextype" value="htmlhelp"/>
  129. <param name="encoding" value="${args.dita.locale}" if="args.dita.locale"/>
  130. <param name="defaultLanguage" expression="${default.language}"/>
  131. </module>
  132. </pipeline>
  133. </target>
  134. <!-- Deprecated since 2.1 -->
  135. <target name="dita.out.map.htmlhelp.hhk" depends="dita.map.htmlhelp.init" if="inner.transform"
  136. description="Build HTMLHelp HHK file">
  137. <dita-ot-echo id="DOTX070W"><param name="1" value="dita.out.map.htmlhelp.hhk"/></dita-ot-echo>
  138. <pipeline message="Extract index term." tempdir="${dita.temp.dir}" inputmap="${user.input.file}">
  139. <module class="org.dita.dost.module.IndexTermExtractModule">
  140. <param name="output" location="${output.dir}/${dita.map.filename.root}.hhk"/>
  141. <param name="targetext" value="${out.ext}"/>
  142. <param name="indextype" value="htmlhelp"/>
  143. <param name="encoding" value="${args.dita.locale}" if="args.dita.locale"/>
  144. </module>
  145. </pipeline>
  146. </target>
  147. <target name="dita.htmlhelp.convertlang">
  148. <taskdef name="check-lang" classname="org.dita.dost.util.CheckLang">
  149. <classpath refid="dost.class.path"/>
  150. </taskdef>
  151. <taskdef name="convert-lang" classname="org.dita.dost.util.ConvertLang">
  152. <classpath refid="dost.class.path"/>
  153. </taskdef>
  154. <check-lang message="Check Language"
  155. basedir="${basedir}"
  156. tempdir="${dita.temp.dir}"
  157. inputmap="${user.input.file}"
  158. outputdir="${output.dir}"/>
  159. <convert-lang message="Convert Language"
  160. basedir="${basedir}"
  161. outputdir="${output.dir}"
  162. langcode="${htmlhelp.locale}"/>
  163. </target>
  164. <target name="compile.HTML.Help" if="HTMLHelpCompiler" description="Compile HTMLHelp output">
  165. <condition property="compile.dir" value="${output.dir}">
  166. <isset property="inner.transform"/>
  167. </condition>
  168. <condition property="compile.dir" value="${dita.map.output.dir}">
  169. <isset property="old.transform"/>
  170. </condition>
  171. <exec executable="${HTMLHelpCompiler}"
  172. failonerror="${failonerror}"
  173. failifexecutionfails="${failonerror}">
  174. <arg value="${compile.dir}${file.separator}${dita.map.filename.root}.hhp"/>
  175. </exec>
  176. </target>
  177. </project>