-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_dita2odt.xml
187 lines (172 loc) · 8.17 KB
/
build_dita2odt.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is part of the DITA Open Toolkit project.
See the accompanying license.txt file for applicable licenses.-->
<!-- (c) Copyright IBM Corp. 2006 All Rights Reserved. -->
<project name="dita2odt">
<target name="set_odt_output_tempdir">
<condition property="odt.output.tempdir" value="${dita.map.output.dir}/${uplevels}temp">
<not>
<isset property="odt.output.tempdir"/>
</not>
</condition>
<copy todir="${odt.output.tempdir}">
<fileset dir="${dita.map.output.dir}/${uplevels}">
<exclude name="**/*.list"/>
<exclude name="**/*.log"/>
<exclude name="**/*.temp"/>
<exclude name="**/*.properties"/>
<exclude name="**/*.odt"/>
<exclude name="temp/**"/>
</fileset>
</copy>
</target>
<target name="clean_output_tempdir" unless="$flag">
<delete failonerror="yes" includeemptydirs="true" dir="${odt.output.tempdir}" />
</target>
<target name="dita2odt"
depends="dita2odt.init, build-init, preprocess, odt.image-metadata, set_odt_output_tempdir, dita.odt.package.topic, dita.odt.package.map, move-output-file, clean_output_tempdir">
</target>
<target name="dita2odt.init">
<property name="odt.suffix" value=".odt" />
<condition property="args.rellinks" value="none">
<not><isset property="args.rellinks"/></not>
</condition>
</target>
<target name="odt.image-metadata" description="Read image metadata">
<pipeline message="Read image metadata." taskname="image-metadata" tempdir="${dita.temp.dir}">
<module class="org.dita.dost.module.ImageMetadataModule">
<param name="outputdir" location="${output.dir}"/>
</module>
</pipeline>
</target>
<target name="map2odt" unless="noMap">
<antcall target="dita.map.odt">
<param name="input"
value="${dita.temp.dir}${file.separator}${user.input.file}" />
<param name="output"
value="${odt.output.tempdir}${file.separator}content.xml" />
</antcall>
</target>
<target name="topic2odt" if="noMap">
<antcall target="dita.topic.odt">
<param name="input"
value="${dita.temp.dir}${file.separator}${user.input.file}" />
<param name="output"
value="${odt.output.tempdir}${file.separator}content.xml" />
</antcall>
</target>
<!-- Build odt content.xml from DITA -->
<target name="dita.map.odt" description="Build odt content.xml file">
<condition property="args.xsl"
value="${dita.plugin.org.dita.odt.dir}/xsl/dita2odt.xsl">
<not>
<isset property="args.xsl" />
</not>
</condition>
<dirname file="${output}" property="dita.odt.outputdir" />
<!--create topic merge file -->
<dirname property="dita.temp.dir.fullpath" file="${dita.temp.dir}${file.separator}dummy.file"/>
<pipeline message="topicmerge"
inputmap="${dita.temp.dir.fullpath}${file.separator}${user.input.file}"
tempdir="${dita.temp.dir.fullpath}">
<module class="org.dita.dost.module.TopicMergeModule">
<param name="output" location="${dita.temp.dir.fullpath}${file.separator}${dita.map.filename.root}_MERGED.xml"/>
<param name="style" location="${dita.plugin.org.dita.odt.dir}/xsl/xslodt/common/topicmerge.xsl"/>
</module>
</pipeline>
<!--create content.xml -->
<!--Change path of ${dita.input.valfile} into url-->
<makeurl file="${dita.input.valfile}" property="dita.input.valfile.url" validate="no"/>
<xslt basedir="${dita.temp.dir}"
in="${dita.temp.dir}${file.separator}${dita.map.filename.root}_MERGED.xml"
classpathref="dost.class.path"
out="${output}" style="${args.xsl}"
filenameparameter="FILENAME"
filedirparameter="FILEDIR">
<param name="BASEDIR" expression="${basedir}"/>
<param name="TEMPDIR" expression="${dita.temp.dir}"/>
<param name="DRAFT" expression="${args.draft}" if="args.draft" />
<param name="FILTERFILE" expression="${dita.input.valfile.url}" if="dita.input.valfile" />
<param name="OUTPUTDIR" expression="${dita.odt.outputdir}" />
<param name="include.rellinks" expression="${include.rellinks}"/>
<param name="INDEXSHOW" expression="${args.indexshow}" if="args.indexshow"/>
<param name="DBG" expression="${args.debug}" if="args.debug"/>
<param name="defaultLanguage" expression="${default.language}"/>
<xmlcatalog refid="dita.catalog"/>
</xslt>
</target>
<target name="dita.topic.odt" description="Build odt content.xml file">
<condition property="args.xsl" value="${dita.plugin.org.dita.odt.dir}/xsl/dita2odt.xsl">
<not>
<isset property="args.xsl" />
</not>
</condition>
<dirname file="${output}" property="dita.odt.outputdir" />
<!--Change path of ${dita.input.valfile} into url-->
<makeurl file="${dita.input.valfile}" property="dita.input.valfile.url" validate="no"/>
<xslt in="${input}" out="${output}" basedir="${dita.temp.dir}"
classpathref="dost.class.path"
style="${args.xsl}"
filenameparameter="FILENAME"
filedirparameter="FILEDIR">
<param name="BASEDIR" expression="${basedir}"/>
<param name="TEMPDIR" expression="${dita.temp.dir}"/>
<param name="DRAFT" expression="${args.draft}" if="args.draft" />
<param name="FILTERFILE" expression="${dita.input.valfile.url}" if="dita.input.valfile" />
<param name="OUTPUTDIR" expression="${dita.odt.outputdir}" />
<param name="include.rellinks" expression="${include.rellinks}"/>
<param name="INDEXSHOW" expression="${args.indexshow}" if="args.indexshow"/>
<param name="DBG" expression="${args.debug}" if="args.debug"/>
<xmlcatalog refid="dita.catalog"/>
</xslt>
</target>
<target name="dita.topic.odt.stylesfile" description="Build odt styles.xml file" if="noMap">
<xslt in="${dita.temp.dir}${file.separator}${user.input.file}"
out="${odt.output.tempdir}${file.separator}styles.xml"
classpathref="dost.class.path"
style="${dita.plugin.org.dita.odt.dir}/xsl/xslodt/dita2odtstyles.xsl">
<xmlcatalog refid="dita.catalog"/>
</xslt>
</target>
<target name="dita.map.odt.stylesfile" description="Build odt styles.xml file" unless="noMap">
<xslt in="${dita.temp.dir}${file.separator}${dita.map.filename.root}_MERGED.xml"
out="${odt.output.tempdir}${file.separator}styles.xml"
classpathref="dost.class.path"
style="${dita.plugin.org.dita.odt.dir}/xsl/xslodt/dita2odtstyles.xsl">
<xmlcatalog refid="dita.catalog"/>
</xslt>
</target>
<target name="dita.out.odt.manifest.file" description="Build odt manifest.xml file">
<xslt in="${dita.temp.dir}${file.separator}${user.input.file}"
out="${odt.output.tempdir}${file.separator}META-INF${file.separator}manifest.xml"
classpathref="dost.class.path"
style="${dita.plugin.org.dita.odt.dir}/xsl/xslodt/dita2odtmanifest.xsl">
<xmlcatalog refid="dita.catalog"/>
</xslt>
</target>
<target name="dita.odt.package.topic" if="noMap" depends="topic2odt, dita.topic.odt.stylesfile, dita.out.odt.manifest.file"
description="Package into odt file">
<zip destfile="${odt.output.tempdir}/${dita.topic.filename.root}${odt.suffix}"
basedir="${odt.output.tempdir}"
excludes="**/*.list, **/*.log, **/*.temp, **/*.properties, **/*.odt">
</zip>
</target>
<target name="dita.odt.package.map" unless="noMap" depends="map2odt, dita.map.odt.stylesfile, dita.out.odt.manifest.file"
description="Package into odt file">
<zip destfile="${odt.output.tempdir}/${dita.map.filename.root}${odt.suffix}"
basedir="${odt.output.tempdir}"
excludes="**/*.list, **/*.log, **/*.temp, **/*.properties, **/*.odt"/>
</target>
<target name="move-output-file">
<move todir="${dita.map.output.dir}/${uplevels}">
<fileset dir="${odt.output.tempdir}">
<include name="**/*.list"/>
<include name="**/*.log"/>
<include name="**/*.temp"/>
<include name="**/*.properties"/>
<include name="**/*.odt"/>
</fileset>
</move>
<available property="flag" file="${odt.output.tempdir}" type="dir"/>
</target>
</project>