-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-hyphenation-info.xml
240 lines (209 loc) · 8.34 KB
/
build-hyphenation-info.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
<?xml version="1.0" encoding="UTF-8"?>
<project name="hyphenation-info-run" basedir="." default="build">
<description>Build file for running the 'hyphenation-info' facility for
checking FO documents that include Antenna House
extensions.</description>
<!--
Copyright 2015-2022 Antenna House, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<dirname property="hyphenation-info.basedir" file="${ant.file.hyphenation-info}"/>
<pathconvert property="hyphenation-info.basedir.converted" dirsep="/">
<path location="${hyphenation-info.basedir}" />
<!-- Ant under cygwin uses a lowercase drive letter, which some Java
programs don't recognise as a drive letter, so translate. -->
<map from="c:" to="/C:"/>
<map from="d:" to="/D:"/>
<map from="e:" to="/E:"/>
</pathconvert>
<pathconvert property="basedir.converted" dirsep="/">
<path location="${basedir}" />
<!-- Ant under cygwin uses a lowercase drive letter, which some Java
programs don't recognise as a drive letter, so translate. -->
<map from="c:" to="/C:"/>
<map from="d:" to="/D:"/>
<map from="e:" to="/E:"/>
</pathconvert>
<!-- Local file of properties determining or describing local
configuration. -->
<property name="build.local.properties"
location="${basedir.converted}/build.local.properties"/>
<property file="${build.local.properties}"/>
<!-- XML file of properties determining or describing local
configuration. -->
<property name="build.properties.xml"
location="${hyphenation-info.basedir.converted}/properties.xml"/>
<property file="${build.properties.xml}"/>
<!-- File of properties determining or describing local
configuration. -->
<property name="build.properties"
location="${hyphenation-info.basedir.converted}/build.properties"/>
<property file="${build.properties}"/>
<!-- Input and output file properties. -->
<!-- Where to find RELAX NG Compact Syntax schema files. -->
<property name="rnc.dir"
value="${hyphenation-info.basedir.converted}/schema" />
<!-- Where to find RELAX NG XML Syntax schema files. -->
<property name="rng.dir"
value="${hyphenation-info.basedir.converted}/rng" />
<!-- Where to find DTD files. -->
<property name="dtd.dir"
value="${hyphenation-info.basedir.converted}/dtd" />
<!-- Where to find W3C XML Schema (XSD) files. -->
<property name="xsd.dir"
value="${hyphenation-info.basedir.converted}/xsd" />
<!-- Where to find Schematron files. -->
<property name="schematron.dir" value="${hyphenation-info.basedir.converted}/schematron" />
<!-- Where to find XSLT files. -->
<property name="xsl.dir" value="${hyphenation-info.basedir.converted}/xsl" />
<!-- Basename of main (outermost) schema file. -->
<property name="schema.basename" value="hyphenation-info" />
<!-- Basename of main (outermost) schema file to convert to XSD. -->
<!-- Cannot use 'axf-mathml3-svg11' because of 'externalRef is not yet
supported' errors from 'trang'. -->
<property name="xsd.schema.basename" value="${schema.basename}" />
<!-- Main Schematron file. -->
<property name="schematron" value="${schematron.dir}/hyphenation-info.sch" />
<!-- Where to find built files such as compiled Schematron. -->
<property name="build.dir" value="${hyphenation-info.basedir.converted}/build" />
<!-- Housekeeping properties -->
<!-- Whether to force processing to run. -->
<property name="force" value="no" />
<!-- Whether to delete temporary files on exit. -->
<property name="deleteonexit" value="false" />
<!-- saxon.jar location depends on if run from oXygen or on OS. -->
<condition property="saxon.jar" value="${ant.home}/../../lib/saxon9ee.jar">
<contains string="${ant.home}" substring="oxygen" casesensitive="false" />
</condition>
<condition property="saxon.jar" value="${saxon.jar.windows}">
<os family="windows" />
</condition>
<condition property="saxon.jar" value="${saxon.jar.mac}">
<os family="mac" />
</condition>
<property name="saxon.jar" value="${saxon.jar.unix}" />
<!-- jing.jar location depends on if run from oXygen or on OS. -->
<condition property="jing.jar" value="${ant.home}/../../lib/jing.jar">
<contains string="${ant.home}" substring="oxygen" casesensitive="false" />
</condition>
<condition property="jing.jar" value="${jing.jar.windows}">
<os family="windows" />
</condition>
<condition property="jing.jar" value="${jing.jar.mac}">
<os family="mac" />
</condition>
<property name="jing.jar" value="${jing.jar.unix}" />
<taskdef name="jing"
classname="com.thaiopensource.relaxng.util.JingTask"
classpath="${jing.jar}" />
<!-- Targets -->
<!-- Validation targets -->
<target name="single.basename">
<fail unless="single"
message="'single' property must be set to filename of single XML file to process." />
<!-- Basename of single file to process. -->
<basename property="single.basename" file="${single}" suffix=".xml" />
</target>
<target name="validate.single" depends="single.basename">
<jing rngfile="${rnc.dir}/rng/${schema.basename}.rng"
file="${single}" />
<schematron>
<fileset file="${single}"/>
</schematron>
</target>
<macrodef name="schematron"
description="Runs Schematron using Saxon">
<attribute name="schematron"
default="${schematron}"
description="Schematron file to use." />
<attribute name="basedir"
default="${basedir.converted}"
description="Base directory from which to run Schematron." />
<attribute name="saxon.jar"
default="${saxon.jar}"
description="Location of Saxon jar." />
<element name="files"
implicit="true"
description="Fileset or similar on which to run Schematron." />
<sequential>
<echo message="Running '@{schematron}' Schematron. SVRL in 'out'."/>
<local name="filenames" />
<mkdir dir="${basedir.converted}/out"/>
<mappedresources id="filenames">
<files />
<chainedmapper>
<flattenmapper />
<globmapper from="*.fo" to="*.svrl" />
</chainedmapper>
</mappedresources>
<echo message="Validate" />
<!-- validate -->
<xslt destdir="${basedir.converted}/out"
style="${build.dir}/schematron.xsl"
useimplicitfileset="false"
classpath="@{saxon.jar}"
force="${force}">
<factory name="net.sf.saxon.TransformerFactoryImpl">
<attribute
name="http://saxon.sf.net/feature/allow-external-functions"
value="true"/>
<attribute
name="http://saxon.sf.net/feature/linenumbering"
value="true"/>
</factory>
<files />
<chainedmapper>
<flattenmapper />
<globmapper from="*.fo" to="*.svrl" />
</chainedmapper>
</xslt>
<local name="ignore-me" />
<local name="ignore-me.basename" />
<tempfile property="ignore-me"
prefix="ignore-me"
destdir="${basedir.converted}"
deleteonexit="true"/>
<basename property="ignore-me.basename" file="${ignore-me}" />
<!-- check -->
<xslt basedir="${basedir.converted}/out"
destdir="${basedir.converted}"
useimplicitfileset="false"
style="${build.dir}/check-schematron.xsl"
classpath="${saxon.jar}"
force="true">
<factory name="net.sf.saxon.TransformerFactoryImpl">
<attribute
name="http://saxon.sf.net/feature/validation-warnings"
value="false"/>
<attribute
name="http://saxon.sf.net/feature/linenumbering"
value="true"/>
</factory>
<resources refid="filenames" />
<mergemapper to="${ignore-me.basename}" />
</xslt>
</sequential>
</macrodef>
<target name="schematron.single" depends="single.basename">
<schematron>
<fileset file="${single}"/>
</schematron>
</target>
<target name="schematron.dir">
<schematron>
<fileset dir="${dir}" includes="*.fo" />
</schematron>
</target>
<!-- Utility targets. -->
<target name="echoproperties">
<echoproperties />
</target>
</project>