build_dita2xhtml_template.xml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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="dita2xhtml">
  11. <target name="dita2xhtml.init">
  12. <property name="html-version" value="xhtml"/>
  13. </target>
  14. <target name="dita2xhtml"
  15. depends="dita2xhtml.init,
  16. build-init,
  17. preprocess,
  18. xhtml.topics,
  19. dita.map.xhtml,
  20. copy-css">
  21. </target>
  22. <target name="dita.map.xhtml"
  23. depends="dita.map.xhtml.init, dita.map.xhtml.toc" />
  24. <target name="dita.map.xhtml.init" unless="noMap">
  25. <condition property="args.xhtml.toc.xsl" value="${dita.plugin.org.dita.xhtml.dir}/xsl/map2${html-version}-cover.xsl">
  26. <not>
  27. <isset property="args.xhtml.toc.xsl" />
  28. </not>
  29. </condition>
  30. <condition property="args.xhtml.toc" value="index">
  31. <not>
  32. <isset property="args.xhtml.toc" />
  33. </not>
  34. </condition>
  35. </target>
  36. <target name="dita.map.xhtml.toc"
  37. unless="noMap"
  38. description="Build HTML TOC file">
  39. <map.html>
  40. <dita:extension id="dita.conductor.xhtml.toc.param" behavior="org.dita.dost.platform.InsertAction"/>
  41. </map.html>
  42. </target>
  43. <macrodef name="map.html">
  44. <element name="params" optional="true" implicit="true"/>
  45. <sequential>
  46. <local name="xhtml.toc.output.dir"/>
  47. <condition property="xhtml.toc.output.dir" value="${dita.output.dir}" else="${_dita.map.output.dir}">
  48. <isset property="inner.transform"/>
  49. </condition>
  50. <pipeline>
  51. <xslt destdir="${xhtml.toc.output.dir}"
  52. style="${args.xhtml.toc.xsl}">
  53. <ditafileset input="true"/>
  54. <param name="OUTEXT" expression="${out.ext}" if:set="out.ext" />
  55. <param name="contenttarget" expression="${args.xhtml.contenttarget}" if:set="args.xhtml.contenttarget"/>
  56. <param name="CSS" expression="${args.css.file}" if:set="args.css.file" />
  57. <param name="CSSPATH" expression="${user.csspath}" if:set="user.csspath" />
  58. <param name="OUTPUTCLASS" expression="${args.xhtml.toc.class}" if:set="args.xhtml.toc.class" />
  59. <params/>
  60. <mapper type="merge" to="${args.xhtml.toc}${out.ext}"/>
  61. <xmlcatalog refid="dita.catalog"/>
  62. </xslt>
  63. </pipeline>
  64. </sequential>
  65. </macrodef>
  66. <!-- Deprecated since 2.1 -->
  67. <target name="dita.out.map.xhtml.toc"
  68. unless="noMap" if="inner.transform"
  69. description="Build HTML TOC file,which will adjust the directory">
  70. <dita-ot-echo id="DOTX070W"><param name="1" value="dita.out.map.xhtml.toc"/></dita-ot-echo>
  71. <pipeline>
  72. <xslt destdir="${dita.output.dir}"
  73. style="${args.xhtml.toc.xsl}">
  74. <ditafileset input="true"/>
  75. <param name="OUTEXT" expression="${out.ext}" if:set="out.ext" />
  76. <param name="contenttarget" expression="${args.xhtml.contenttarget}" if:set="args.xhtml.contenttarget"/>
  77. <param name="CSS" expression="${args.css.file}" if:set="args.css.file" />
  78. <param name="CSSPATH" expression="${user.csspath}" if:set="user.csspath" />
  79. <param name="OUTPUTCLASS" expression="${args.xhtml.toc.class}" if:set="args.xhtml.toc.class" />
  80. <dita:extension id="dita.conductor.xhtml.toc.param" behavior="org.dita.dost.platform.InsertAction"/>
  81. <mapper type="glob"
  82. from="${user.input.file}"
  83. to="${args.xhtml.toc}${out.ext}" />
  84. <xmlcatalog refid="dita.catalog"/>
  85. </xslt>
  86. </pipeline>
  87. </target>
  88. <target name="copy-revflag" if="dita.input.valfile">
  89. <dita-ot-echo id="DOTA069W">
  90. <param name="1" value="copy-revflag"/>
  91. </dita-ot-echo>
  92. </target>
  93. <target name="copy-css" unless="user.csspath.url" description="Copy CSS files">
  94. <condition property="user.copycss.yes">
  95. <and>
  96. <equals arg1="${args.copycss}" arg2="yes"/>
  97. <isset property="args.css.present"/>
  98. </and>
  99. </condition>
  100. <property name="user.csspath.real" location="${dita.output.dir}/${user.csspath}"/>
  101. <mkdir dir="${user.csspath.real}"/>
  102. <!-- Always copy system default css files -->
  103. <copy todir="${user.csspath.real}">
  104. <fileset dir="${dita.plugin.org.dita.xhtml.dir}/resource" includes="*.css"/>
  105. </copy>
  106. <!-- Copy user specify css file when required -->
  107. <antcall target="copy-css-user"/>
  108. </target>
  109. <target name="copy-css-user" if="user.copycss.yes">
  110. <copy file="${args.css.real}" todir="${user.csspath.real}"/>
  111. </target>
  112. </project>