-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.xml
129 lines (111 loc) · 5.54 KB
/
build.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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="cgrid" default="pdf">
<!-- import default properties from file -->
<property file="local.build.properties"/>
<property file="build.properties"/>
<!-- need to put jing.jar into ant lib folder (e.g. ~/.ant/lib; /usr/share/java/ant-1.8.4/lib for MacOS 10.8; /usr/share/ant/lib for Debian) -->
<taskdef name="jing" classname="com.thaiopensource.relaxng.util.JingTask"/>
<!-- need to put ant-schematron.jar into ant lib folder (e.g. ~/.ant/lib) -->
<taskdef name="schematron" classname="com.schematron.ant.SchematronTask"/>
<target name="init">
<mkdir dir="${build.dir}"/>
</target>
<target name="clean">
<delete dir="${build.dir}"/>
</target>
<target name="get-current-workingcopy-revision">
<description>Get the current subversion revision of the working copy</description>
<exec executable="${bash.command}" outputproperty="local.revision">
<arg value="-c"/>
<arg value="${svn.command} info | ${egrep.command} 'Last Changed Rev' | ${egrep.command} -o '[[:digit:]]+'"/>
<env key="LANG" value="C"/>
</exec>
<echo>Current revision of the working copy: ${local.revision}</echo>
</target>
<target name="tei2latex" depends="init">
<description>Convert the master TEI file to latex</description>
<xslt processor="trax" style="scripts/to-latex.xsl" in="tei/master.xml" out="${build.dir}/cgrid.tex">
<factory name="net.sf.saxon.TransformerFactoryImpl">
<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
</factory>
<param name="documentClass" expression="${latex.documentClass}"/>
<param name="output" expression="${latex.output}"/>
<param name="headings" expression="${latex.headings}"/>
<param name="fontsize" expression="${latex.fontsize}"/>
<param name="DIV" expression="${latex.DIV}"/>
<param name="paper" expression="${latex.paper}"/>
<param name="revision" expression="${local.revision}" if="local.revision"/>
</xslt>
</target>
<target name="latex" depends="tei2latex">
<description>Process the Latex master file and output PDF</description>
<exec executable="${latex.command}">
<arg value="-output-directory=${build.dir}"/>
<arg value="-shell-escape"/>
<arg value="${build.dir}/cgrid.tex"/>
</exec>
</target>
<target name="validate">
<description>Validate the articles from the tei folder against the cgrid.rng schema.</description>
<tempfile deleteonexit="true" suffix=".xml" destdir="${build.dir}" property="schematron.out"/>
<echo level="info">Validating with RelaxNG</echo>
<jing rngfile="schemata/cgrid.rng">
<fileset dir="tei">
<exclude name="README.md"/>
<exclude name="master.xml"/>
</fileset>
</jing>
<echo level="info">Validating with Schematron</echo>
<schematron schema="schemata/cgrid.isosch" outputFilename="${schematron.out}" failonerror="false" queryLanguageBinding="xslt2">
<fileset dir="tei">
<exclude name="README.md"/>
<exclude name="master.xml"/>
</fileset>
</schematron>
</target>
<target name="linkChecker" depends="init">
<description>Checks all external URLs via linkchecker cli</description>
<xslt processor="trax" style="scripts/extract-URLs.xsl" in="tei/master.xml" out="${build.dir}/urls.html">
<factory name="net.sf.saxon.TransformerFactoryImpl">
<attribute name="http://saxon.sf.net/feature/xinclude-aware" value="true"/>
</factory>
</xslt>
<exec executable="${bash.command}">
<arg value="-c"/>
<arg value="linkchecker ${build.dir}/urls.html -r1 --timeout=20 -onone --check-extern --file-output=xml/utf8/${build.dir}/linkchecker.out.xml"/>
<env key="LANG" value="C"/>
</exec>
<echo>Linkchecker report created at ${build.dir}/linkchecker.out.xml</echo>
</target>
<target name="makeindex" depends="latex">
<description>Create the Latex index for persons</description>
<antcall target="latex"/>
<exec executable="${makeindex.command}">
<arg line="${build.dir}/cgrid.idx -C utf8 -L german-duden -M latex/basic.xdy"/>
</exec>
</target>
<target name="copyIndex" depends="init">
<copy todir="${build.dir}" file="latex/cgrid.ind"/>
</target>
<target name="pdf" depends="copyIndex">
<description>Create the final PDF with all indices</description>
<antcall target="latex">
<!--<param name="latex.output" value="print"/>-->
</antcall>
<antcall target="latex"/>
<antcall target="latex"/>
</target>
<target name="fahne" depends="get-current-workingcopy-revision">
<description>Erstellt Korrekturfahnen für die Autor_innen inkl. Revisionsangabe</description>
<antcall target="latex">
<param name="latex.output" value="print"/>
</antcall>
<antcall target="latex"/>
</target>
<target name="biblio">
<description>Erstellt eine Literaturliste aus dem master.xml</description>
<antcall target="latex">
<param name="latex.output" value="biblio"/>
</antcall>
</target>
</project>