1 | <!--
|
---|
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 |
|
---|
6 | (C) Copyright Shawn McKenzie, 2007. All Rights Reserved.
|
---|
7 |
|
---|
8 | UPDATES:
|
---|
9 | 20110817 RDA: Several changes:
|
---|
10 | * Use property dita.plugin.com.sophos.tocjs.dir (remove hard-coded demo/ dir)
|
---|
11 | * Original design only works if $output.file is set in an Ant file, and
|
---|
12 | if XHTML is created independently. Refactoring to use that original
|
---|
13 | processing when $output.file is specified; otherwise:
|
---|
14 | 1) Return HTML files along with navigation
|
---|
15 | 2) Return default frameset (with name based on map name)
|
---|
16 | 3) Set $output.file to a default value of toctree.js
|
---|
17 | 4) Return supporting JS and CSS files for the default frameset
|
---|
18 | *-->
|
---|
19 | <project>
|
---|
20 |
|
---|
21 | <target name="dita2tocjs" depends="build-init, preprocess, tocjsInit, map2tocjs, topic2tocjs, tocjsDefaultOutput">
|
---|
22 | </target>
|
---|
23 |
|
---|
24 | <target name="tocjsInit">
|
---|
25 | <condition property="dita.plugin.com.sophos.tocjs.copydefaults" value="true">
|
---|
26 | <not>
|
---|
27 | <isset property="output.file" />
|
---|
28 | </not>
|
---|
29 | </condition>
|
---|
30 | <condition property="output.file" value="${output.dir}${file.separator}toctree.js">
|
---|
31 | <not>
|
---|
32 | <isset property="output.file" />
|
---|
33 | </not>
|
---|
34 | </condition>
|
---|
35 | </target>
|
---|
36 |
|
---|
37 | <target name="topic2tocjs" if="noMap">
|
---|
38 | <antcall target="dita.map.tocjs">
|
---|
39 | <!-- No real support for tocjs on a single topic, only for map -->
|
---|
40 | </antcall>
|
---|
41 | <echo>The TocJS output type only supports ditamap files as input.</echo>
|
---|
42 | </target>
|
---|
43 |
|
---|
44 | <target name="map2tocjs" unless="noMap">
|
---|
45 | <antcall target="dita.map.tocjs">
|
---|
46 | <param name="input" value="${dita.temp.dir}${file.separator}${user.input.file}"/>
|
---|
47 | </antcall>
|
---|
48 | </target>
|
---|
49 |
|
---|
50 | <target name="dita.map.tocjs" description="generate merged for tocjs">
|
---|
51 | <xslt in="${input}" out="${output.file}"
|
---|
52 | style="${dita.plugin.com.sophos.tocjs.dir}/xsl/tocjs.xsl">
|
---|
53 | <param name="contentwin" expression="${content.frame}" if="content.frame"/>
|
---|
54 | <param name="ditaext" expression="${dita.ext}" if="dita.ext"/>
|
---|
55 | <param name="htmlext" expression="${out.ext}"/>
|
---|
56 | <xmlcatalog refid="dita.catalog"/>
|
---|
57 | </xslt>
|
---|
58 | </target>
|
---|
59 |
|
---|
60 | <target name="tocjsDefaultOutput"
|
---|
61 | if="dita.plugin.com.sophos.tocjs.copydefaults">
|
---|
62 | <!-- Create usable output for people trying tocjs for the first time -->
|
---|
63 | <antcall target="tocjsDefaultXhtmlOutput"/>
|
---|
64 | <antcall target="tocjsDefaultFrameset"/>
|
---|
65 | <!-- Copy default JS and related files -->
|
---|
66 | <copy todir="${output.dir}"><fileset
|
---|
67 | dir="${dita.plugin.com.sophos.tocjs.dir}${file.separator}basefiles"><include name="**/*"/></fileset></copy>
|
---|
68 | </target>
|
---|
69 |
|
---|
70 | <target name="tocjsDefaultXhtmlOutput" depends="dita.map.xhtml, copy-revflag, copy-css , dita.topics.xhtml, dita.inner.topics.xhtml, dita.outer.topics.xhtml">
|
---|
71 | <!-- Preprocess has already completed based on original dependencies;
|
---|
72 | this target continues to XHTML for default output. Seems very
|
---|
73 | indirect way to create the XHTML, so would like something better,
|
---|
74 | but do not want to add new XHTML processing for people using
|
---|
75 | the original dita2tocjs target. -->
|
---|
76 | </target>
|
---|
77 |
|
---|
78 | <target name="tocjsDefaultFrameset" if="dita.plugin.com.sophos.tocjs.copydefaults">
|
---|
79 | <!-- Create the default frameset itself -->
|
---|
80 | <condition property="out.ext" value=".html">
|
---|
81 | <not>
|
---|
82 | <isset property="out.ext" />
|
---|
83 | </not>
|
---|
84 | </condition>
|
---|
85 | <xslt
|
---|
86 | basedir="${dita.temp.dir}"
|
---|
87 | destdir="${output.dir}"
|
---|
88 | includesfile="${dita.temp.dir}${file.separator}${user.input.file.listfile}"
|
---|
89 | extension="${out.ext}"
|
---|
90 | style="${dita.plugin.com.sophos.tocjs.dir}${file.separator}xsl${file.separator}frameset.xsl">
|
---|
91 | <excludesfile name="${dita.temp.dir}${file.separator}${resourceonlyfile}" if="resourceonlyfile"/>
|
---|
92 | <param name="DITAEXT" expression="${dita.ext}" if="dita.ext"/>
|
---|
93 | <param name="OUTEXT" expression="${out.ext}" if="out.ext"/>
|
---|
94 | <param name="CSSPATH" expression="${CSSPATH}" if="csspath"/>
|
---|
95 | <xmlcatalog refid="dita.catalog"/>
|
---|
96 | </xslt>
|
---|
97 | </target>
|
---|
98 |
|
---|
99 | </project>
|
---|