-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
141 lines (134 loc) · 5.22 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
130
131
132
133
134
135
136
137
138
139
140
141
<?xml version="1.0"?>
<project
xmlns="antlib:org.apache.tools.ant"
name="mathjax4svg"
default="site"
basedir="."
>
<property name="project.name" value="${ant.project.name}"/>
<property name="project.title.name" value="MathJax4SVG"/>
<property name="project.version" value="0.3.1"/>
<property name="javadir" location="/usr/share/java"/>
<property name="target" location="target"/>
<property name="target.site" location="${target}/site"/>
<property name="target.dist" location="${target}/dist"/>
<property name="src" location="src"/>
<property name="src.js" location="${src}/js"/>
<property name="src.site" location="${src}/site"/>
<property name="sysconfdir" location="/etc"/>
<property name="xml.catalog" location="${sysconfdir}/xml/catalog"/>
<property name="docbook.catalog" location="${sysconfdir}/xml/docbook5-xsl-stylesheets.xml"/>
<property name="mathml.catalog" location="${sysconfdir}/xml/mathml.xml"/>
<property name="saxon6.jar" location="${javadir}/saxon6.jar"/>
<property name="xslt.html.stylesheet" value="${project.title.name}.css"/>
<property name="xslt.highlight.xslthl.config" location="${src.site}/xslthl/highlighters/xslthl-config.xml"/>
<property name="polyfill.url" value="https://polyfill.io/v3/polyfill.min.js?features=es6"/>
<property name="mathjax.url" value="https://cdn.jsdelivr.net/npm/mathjax@3/es5/mml-chtml.js"/>
<presetdef name="xslt.preset">
<xslt
style="${src.site}/xhtml.xsl"
basedir="${src.site}"
filedirparameter="${src.site}"
extension=".xhtml"
force="true"
>
<factory name="com.icl.saxon.TransformerFactoryImpl"/>
<xmlcatalog>
<catalogpath>
<pathelement location="${xml.catalog}"/>
<pathelement location="${docbook.catalog}"/>
<pathelement location="${mathml.catalog}"/>
</catalogpath>
<dtd publicId="generated" location="${target}/generated.ent"/>
</xmlcatalog>
<classpath>
<pathelement location="${saxon6.jar}"/>
<pathelement location="${javadir}/xml-commons-resolver.jar"/>
<pathelement location="${javadir}/docbook-xsl-saxon.jar"/>
<pathelement location="${javadir}/xslthl.jar"/>
</classpath>
<param name="highlight.source" expression="1"/>
<param name="profile.status" expression="${xslt.profile.status}"/>
<param name="rootid" expression="${xslt.rootid}" if="${xslt.rootid}"/>
<param name="html.stylesheet" expression="${xslt.html.stylesheet}"/>
<param name="shortcut.icon" expression="${xslt.shortcut.icon}"/>
<param name="link.mailto.url" expression="${xslt.link.mailto.url}"/>
<param name="generate.manifest" expression="0"/>
<param name="bibliography.numbered" expression="1"/>
<param name="draft.mode" expression="'maybe'"/>
<param name="highlight.xslthl.config" expression="file://${xslt.highlight.xslthl.config}"/>
<param name="polyfill.url" expression="${polyfill.url}"/>
<param name="mathjax.url" expression="${mathjax.url}"/>
<param name="base.dir" expression="${target.site}"/>
<param name="root.filename" expression="${project.title.name}"/>
</xslt>
</presetdef>
<macrodef name="xslt.lang">
<attribute name="lang"/>
<sequential>
<xslt.preset
includes="${project.title.name}-@{lang}.docbook"
out="XXX"
destdir="${target.site}"
>
<param name="html.ext" expression="-@{lang}.xhtml"/>
<param name="l10n.gentext.default.language" expression="@{lang}"/>
</xslt.preset>
</sequential>
</macrodef>
<target name="site" description="Make site" depends="css">
<mkdir dir="${target.site}"/>
<symlink
resource="${src.site}/examples"
link="examples"
overwrite="true"
/>
<echo file="${target}/generated.ent"><?xml version="1.0" encoding="UTF-8"?><!ENTITY mathjax.url "${mathjax.url}"></echo>
<xslt.lang lang="en"/>
<xslt.lang lang="ru"/>
<copy todir="${target.site}">
<fileset dir="${src.js}" includes="*.js"/>
<filterset>
<propertyset>
<propertyref name="polyfill.url"/>
<propertyref name="mathjax.url"/>
</propertyset>
</filterset>
</copy>
<copy todir="${target.site}">
<fileset file="LICENSE"/>
<fileset dir="${src.site}" includes="*.png *.svg"/>
<fileset dir="${src.site}" includes="examples/**"/>
</copy>
<symlink
resource="../${project.title.name}.js"
link="${target.site}/examples/${project.title.name}.js"
overwrite="true"
/>
<symlink link="examples" action="delete"/>
</target>
<target name="css" description="Make CSS">
<mkdir dir="${target.site}"/>
<dependset>
<srcfilelist dir="${src.site}" files="*.scss"/>
<targetfileset dir="${target.site}" includes="${project.name}.css"/>
</dependset>
<apply executable="sassc" dest="${target.site}" parallel="false">
<arg value="--style"/>
<arg value="compact"/>
<srcfile/>
<targetfile/>
<fileset dir="${src.site}" includes="${project.title.name}.scss"/>
<mapper type="glob" from="*.scss" to="*.css"/>
</apply>
</target>
<target name="dist" description="Prepare distribution">
<mkdir dir="${target.dist}/${project.version}"/>
<copy todir="${target.dist}/${project.version}">
<fileset dir="${src.js}" includes="${project.name}.js"/>
</copy>
</target>
<target name="clean" description="Clean build dir">
<delete dir="${target}"/>
</target>
</project>