build_dita2troff.xml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 name="dita2troff">
  7. <target name="dita2troff-ast.init">
  8. <property name="troff-ast.xsl" location="${dita.plugin.org.dita.troff.dir}/xsl/dita2troff-ast-shell.xsl"/>
  9. </target>
  10. <target name="dita2troff.init">
  11. <property name="out.ext" value=".cli"/>
  12. <property name="troff.step2.xsl" location="${dita.plugin.org.dita.troff.dir}/xsl/dita2troff-step2-shell.xsl"/>
  13. </target>
  14. <target name="dita2troff"
  15. depends="dita2troff-ast.init, dita2troff.init, build-init, preprocess, dita.topic.troff-ast, dita.topic.troff, dita.inner.topic.troff">
  16. </target>
  17. <target name="dita.topic.troff-ast" unless="noTopic" depends="dita2troff-ast.init"
  18. description="Build Troff-specific AST output from dita topics.">
  19. <xslt basedir="${dita.temp.dir}"
  20. destdir="${dita.temp.dir}" includesfile="${dita.temp.dir}${file.separator}${fullditatopicfile}"
  21. extension=".dita"
  22. classpathref="dost.class.path"
  23. style="${troff-ast.xsl}">
  24. <excludesfile name="${dita.temp.dir}${file.separator}${resourceonlyfile}" if="resourceonlyfile"/>
  25. <param name="defaultLanguage" expression="${default.language}"/>
  26. <mapper type="glob" from="*" to="*.ast" />
  27. <xmlcatalog refid="dita.catalog"/>
  28. </xslt>
  29. <move todir="${dita.temp.dir}">
  30. <fileset dir="${dita.temp.dir}" includes="**/*.ast" />
  31. <mapper type="glob" from="*.ast" to="*" />
  32. </move>
  33. </target>
  34. <target name="dita.topic.troff" unless="noTopic" if="old.transform"
  35. description="Build troff output from dita inner and outer topics,which will adjust the directory.">
  36. <xslt basedir="${dita.temp.dir}" destdir="${output.dir}"
  37. includesfile="${dita.temp.dir}${file.separator}${fullditatopicfile}" extension="${out.ext}"
  38. classpathref="dost.class.path"
  39. style="${troff.step2.xsl}">
  40. <excludesfile name="${dita.temp.dir}${file.separator}${resourceonlyfile}" if="resourceonlyfile"/>
  41. <param name="OUTFORMAT" expression="${troff.outformat}" if="troff.outformat"/>
  42. <param name="defaultLanguage" expression="${default.language}"/>
  43. <xmlcatalog refid="dita.catalog"/>
  44. </xslt>
  45. </target>
  46. <!--The new solution which divides the whole process into the inner and outer steps -->
  47. <target name="dita.inner.topic.troff" unless="noTopic" if="inner.transform"
  48. description="Build troff output from inner dita topics">
  49. <echo level="info">the ditmapoutputdir is ${dita.map.output.dir}</echo>
  50. <!-- step 2 -->
  51. <xslt basedir="${dita.temp.dir}" destdir="${output.dir}"
  52. includesfile="${dita.temp.dir}${file.separator}${fullditatopicfile}" extension="${out.ext}"
  53. classpathref="dost.class.path"
  54. style="${troff.step2.xsl}">
  55. <excludesfile name="${dita.temp.dir}${file.separator}${resourceonlyfile}" if="resourceonlyfile"/>
  56. <param name="OUTFORMAT" expression="${troff.outformat}" if="troff.outformat"/>
  57. <mapper type="regexp"
  58. from="^(${tempdirToinputmapdir.relative.value})(.*?)(\.(xml|dita))$$"
  59. to="\2${out.ext}"/>
  60. <xmlcatalog refid="dita.catalog"/>
  61. </xslt>
  62. </target>
  63. </project>