-
Notifications
You must be signed in to change notification settings - Fork 10
/
build_dita2html5-bootstrap_template.xml
292 lines (269 loc) · 9.38 KB
/
build_dita2html5-bootstrap_template.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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<?xml version='1.0' encoding='UTF-8'?>
<!-- Copyright © 2017 · infotexture · Roger W. Fienhold Sheen -->
<!-- See the accompanying LICENSE file for applicable license -->
<project xmlns:if="ant:if" xmlns:dita="http://dita-ot.sourceforge.net">
<target
name="dita2html5-bootstrap"
dita:depends="{bootstrap.process.pre},bootstrap.theme.init,dita2html5-bootstrap.init,
dita2html5,{bootstrap.process.post}"
dita:extension="depends org.dita.dost.platform.InsertDependsAction"
/>
<target
name="bootstrap.scripts.copy"
depends="bootstrap.scripts.popover,
bootstrap.scripts.dark.mode"
/>
<target name="dita-bootstrap.css.copy" description="Copy CSS files">
<property
name="dita-bootstrap.css.dir"
value="${dita.plugin.net.infotexture.dita-bootstrap.dir}/css/"
/>
<!-- Add Common CSS where Bootstrap variables override DITA-OT defaults -->
<loadfile
property="dita-bootstrap.css"
srcFile="${dita-bootstrap.css.dir}/common-bootstrap.css"
/>
<echo
append="true"
message="${line.separator}${dita-bootstrap.css}"
if:set="dita-bootstrap.css.add"
file="${extend.css.file}"
/>
<!--
Append side-toc CSS for the sidebar if present,
Otherwise append none-toc CSS if nav-toc=none.
-->
<condition
property="dita-bootstrap.side-toc.css.file"
value="${dita-bootstrap.css.dir}/none-toc.css"
>
<equals arg1="${nav-toc}" arg2="none"/>
</condition>
<property
name="dita-bootstrap.side-toc.css.file"
value="${dita-bootstrap.css.dir}/side-toc.css"
/>
<loadfile
property="dita-bootstrap.side-toc"
srcFile="${dita-bootstrap.side-toc.css.file}"
/>
<echo
append="true"
message="${line.separator}${dita-bootstrap.side-toc}"
if:set="dita-bootstrap.css.add"
file="${extend.css.file}"
/>
<!-- Append Bootstrap scrollspy CSS if scrollspy-toc is set -->
<condition
if:set="dita-bootstrap.css.add"
property="dita-bootstrap.scrollspy.css.file"
value="${dita-bootstrap.css.dir}/scrollspy-toc.css"
>
<not>
<equals arg1="${scrollspy-toc}" arg2="none"/>
</not>
</condition>
<loadfile
if:set="dita-bootstrap.scrollspy.css.file"
property="dita-bootstrap.scrollspy"
srcFile="${dita-bootstrap.scrollspy.css.file}"
/>
<echo
if:set="dita-bootstrap.scrollspy.css.file"
append="true"
message="${line.separator}${dita-bootstrap.scrollspy}"
file="${extend.css.file}"
/>
<!-- Append Bootstrap menubar-toc CSS if menubar-toc.include=yes -->
<condition
if:set="dita-bootstrap.css.add"
property="dita-bootstrap.menubar-toc.css.file"
value="${dita-bootstrap.css.dir}/menubar-toc.css"
>
<equals arg1="${menubar-toc.include}" arg2="yes"/>
</condition>
<loadfile
if:set="dita-bootstrap.menubar-toc.css.file"
property="dita-bootstrap.menubar-toc"
srcFile="${dita-bootstrap.menubar-toc.css.file}"
/>
<echo
if:set="dita-bootstrap.menubar-toc.css.file"
append="true"
message="${line.separator}${dita-bootstrap.menubar-toc}"
file="${extend.css.file}"
/>
<!-- Append Bootstrap collapsible CSS if toc is collapsible -->
<condition
if:set="dita-bootstrap.css.add"
property="dita-bootstrap.collapsible.css.file"
value="${dita-bootstrap.css.dir}/collapsible-toc.css"
>
<equals arg1="${nav-toc}" arg2="collapsible"/>
</condition>
<loadfile
if:set="dita-bootstrap.collapsible.css.file"
property="dita-bootstrap.collapsible"
srcFile="${dita-bootstrap.collapsible.css.file}"
/>
<echo
if:set="dita-bootstrap.collapsible.css.file"
append="true"
message="${line.separator}${dita-bootstrap.collapsible}"
file="${extend.css.file}"
/>
</target>
<target name="bootstrap.scripts.popover" if="bootstrap.copy.popover">
<!-- Add initialization script for popovers and tooltips -->
<mkdir dir="${dita.output.dir}/js"/>
<copy todir="${dita.output.dir}/js">
<fileset
dir="${dita.plugin.net.infotexture.dita-bootstrap.dir}/includes"
includes="popovers.js"
/>
</copy>
</target>
<target name="bootstrap.scripts.dark.mode" if="bootstrap.copy.dark.mode">
<!-- Add dark mode initialization script -->
<mkdir dir="${dita.output.dir}/js"/>
<copy todir="${dita.output.dir}/js">
<fileset
dir="${dita.plugin.net.infotexture.dita-bootstrap.dir}/includes"
includes="dark-mode-toggler.js"
/>
</copy>
</target>
<target name="dita2html5-bootstrap.init">
<!-- Location of page header template with hard-coded links -->
<property
name="args.hdr"
location="${dita.plugin.net.infotexture.dita-bootstrap.dir}/includes/hdr.navbar.default.xml"
/>
<!-- Location of bootstrap icons if required -->
<makeurl
property="icons.cdn.path"
file="${dita.plugin.net.infotexture.dita-bootstrap.dir}/includes/bootstrap.icons.hdf.xml"
/>
<!--
For DITA-OT 3.0, 3.1 and 3.2 import a version of the
HTML transform without reference to Hazard Statements
-->
<condition
property="bootstrap.xsl"
value="bootstrap-3.0.xsl"
else="bootstrap.xsl"
>
<or>
<equals arg1="${otrelease}" arg2="3.0"/>
<equals arg1="${otrelease}" arg2="3.1"/>
<equals arg1="${otrelease}" arg2="3.2"/>
</or>
</condition>
<!-- Entrypoint for XSL transforms -->
<property
name="args.xsl"
location="${dita.plugin.net.infotexture.dita-bootstrap.dir}/xsl/dita2html5-${bootstrap.xsl}"
/>
<makeurl
if:set="bootstrap.sidebar.hdr"
property="bootstrap.sidebar.hdr.path"
file="${bootstrap.sidebar.hdr}"
/>
<makeurl
if:set="bootstrap.sidebar.ftr"
property="bootstrap.sidebar.ftr.path"
file="${bootstrap.sidebar.ftr}"
/>
<makeurl
if:set="bootstrap.topbar.hdr"
property="bootstrap.topbar.hdr.path"
file="${bootstrap.topbar.hdr}"
/>
<!-- Default parameter values -->
<property name="args.html5.toc" value="toc"/>
<property name="args.copycss" value="yes"/>
<property name="args.csspath" value="css"/>
<property name="icons.include" value="yes"/>
<property name="menubar-toc.include" value="no"/>
<property name="scrollspy-toc" value="none"/>
<property name="nav-toc" value="partial"/>
<property name="popovers.include" value="yes"/>
<property name="dark.mode.include" value="yes"/>
<property name="dita-bootstrap.css.add" value="yes"/>
<!--
Load alternate Bootstrap CSS for RTL languages such as Arabic,
Farsi, Urdu etc. Load standard Bootstrap CSS for LTR languages like English
-->
<condition property="bidi.include" value="yes" else="no">
<matches
string="${default.language}"
pattern="((ar|arc|bcc|bqi|ckb|dv|fa|glk|he|lrc|mzn|pnb|ps|sd|ug|ur|yi)(\-|$))"
/>
</condition>
<condition
property="args.hdf"
value="${dita.plugin.net.infotexture.dita-bootstrap.dir}/includes/bootstrap.hdf.rtl.xml"
else="${dita.plugin.net.infotexture.dita-bootstrap.dir}/includes/bootstrap.hdf.xml"
>
<equals arg1="${bidi.include}" arg2="yes"/>
</condition>
<!-- Add included javascript functions if required -->
<condition property="bootstrap.copy.popover">
<equals arg1="${popovers.include}" arg2="yes"/>
</condition>
<condition property="bootstrap.copy.dark.mode">
<equals arg1="${dark.mode.include}" arg2="yes"/>
</condition>
</target>
<target name="bootstrap.theme.init" if="bootstrap.theme">
<!-- Generate a custom theme based on a hdr template -->
<condition property="bootstrap.rtl" value=".rtl." else=".">
<matches
string="${default.language}"
pattern="((ar|arc|bcc|bqi|ckb|dv|fa|glk|he|lrc|mzn|pnb|ps|sd|ug|ur|yi)(\-|$))"
/>
</condition>
<tempfile
property="bootstrap.theme.file"
suffix=".xml"
deleteonexit="true"
destdir="${java.io.tmpdir}"
/>
<condition
property="bootstrap.template.file"
value="${dita.plugin.net.infotexture.dita-bootstrap.dir}/includes/script-only.hdf.xml"
else="${dita.plugin.net.infotexture.dita-bootstrap.dir}/includes/theme.hdf.xml"
>
<equals arg1="${bootstrap.theme}" arg2="none"/>
</condition>
<condition property="toc-spacer.padding" value="1">
<or>
<equals arg1="${bootstrap.theme}" arg2="darkly"/>
<equals arg1="${bootstrap.theme}" arg2="flatly"/>
<equals arg1="${bootstrap.theme}" arg2="materia"/>
<equals arg1="${bootstrap.theme}" arg2="pulse"/>
<equals arg1="${bootstrap.theme}" arg2="quartz"/>
<equals arg1="${bootstrap.theme}" arg2="sketchy"/>
</or>
</condition>
<condition property="toc-spacer.padding" value="3">
<or>
<equals arg1="${bootstrap.theme}" arg2="lux"/>
</or>
</condition>
<copy
file="${bootstrap.template.file}"
toFile="${bootstrap.theme.file}"
overwrite="true"
/>
<replace
file="${bootstrap.theme.file}"
token="@@theme@@"
value="${bootstrap.theme}/bootstrap${bootstrap.rtl}min.css "
/>
<property name="args.hdf" value="${bootstrap.theme.file}"/>
<property
file="${dita.plugin.net.infotexture.dita-bootstrap.dir}/cfg/${bootstrap.theme}.properties"
/>
</target>
</project>