forked from OpenMath/OMSTD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run
executable file
·227 lines (181 loc) · 5.44 KB
/
run
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
set -e
# http://saxon.sourceforge.net/
if [ -f saxon9he.jar ]; then
export XSLT="java -jar saxon9he.jar -versionmsg:off "
else
export XSLT="java -jar /tmp/jars/saxon9he.jar -versionmsg:off "
fi
# https://code.google.com/archive/p/jing-trang/downloads
if [ -f saxon9he.jar ]; then
export TRANG="java -jar trang.jar "
else
export TRANG="java -jar /tmp/jars/trang.jar "
fi
if [ "$1" == "final" ]
then
DRAFT=no
else
DRAFT=yes
fi
DATE=`date --iso`
echo RNC/xml
for i in omcd2.rnc omcdsig2.rnc openmath2.rnc omcdgroup2.rnc
do
echo $i
perl rnc2dbk $i > ${i%%.rnc}rnc.xml
done
# openmath2.rnc has to be last
echo RNG
for i in omcd2.rnc omcdsig2.rnc omcdgroup2.rnc openmath2.rnc
do
echo $i
$TRANG $i ${i%%rnc}rng
done
# openmath2.rnc has to be last
echo XSD
for i in omcd2.rnc omcdsig2.rnc omcdgroup2.rnc openmath2.rnc
do
echo $i
$TRANG $i ${i%%rnc}xsd
done
>trang.txt
echo DTD
for i in openmath2.rnc
do
echo $i
sed -e "s/attvar =[^}]*}/attvar = OMATTR/" \
-e "s/notom =.*$//" \
-e "s/^.*element \*.*$//" \
-e "s/ (omel|notom)\*/omel/" \
-e "s/^.* text.$//" \
-e "s/{pattern.*}}/}/" \
-e "s/include .openmath2.rnc. {.*}/# OMDTD/" \
$i >tmp.rnc
$TRANG tmp.rnc tmp.dtd 2>> trang.txt
sed -e "s/OMFOREIGN .*>/OMFOREIGN ANY>/" \
-e "s/:*ns1:*//g" \
-e "s/\# OMDTD/<!ENTITY % omdtd SYSTEM \"openmath2.dtd\"> %omdtd;/"\
tmp.dtd > ${i%%rnc}dtd
sed -e "s/</\</g" ${i%%rnc}dtd > ${i%%.rnc}dtd.xml
done
for i in omcd2.rnc
do
echo DTD
echo $i
sed -e "s/| OMOBJ//" \
-e "s/OMOBJ/text/" \
-e "s/include .openmath2.rnc. {.*}/# OMDTD/" \
-e "s/\(CDRevision[^,]*\)[)],/\\1)+,/" \
-e "s/\(Description\)[)],/\\1)+,/" \
-e "s/\(Role\)[?]/\\1/" \
-e "s/ &/ |/g" \
$i >tmp.rnc
$TRANG tmp.rnc tmp.dtd 2>> trang.txt
sed -e "s/text-or-om \"(#PCDATA/text-or-om \"(#PCDATA|OMOBJ/" \
-e "s/FMP (#PCDATA)/FMP (OMOBJ)/" \
-e "s/:ns1//g" \
-e "s/ns1://g" \
-e "s/<!-- OMDTD -->/<!ENTITY % omdtd SYSTEM \"openmath2.dtd\"> %omdtd;/"\
tmp.dtd > ${i%%rnc}dtd
sed -e "s/</\</g" ${i%%rnc}dtd > ${i%%.rnc}dtd.xml
done
echo DTD
echo omcdgroup2.rnc
$TRANG omcdgroup2.rnc omcdgroup2.dtd 2>> trang.txt
# for i in omcdsig2.rnc
# do
# echo DTD
# echo $i
# sed -e "s/| OMOBJ//" \
# -e "s/OMOBJ/text/" \
# -e "s/include .openmath2.rnc. {.*}/# OMDTD/" \
# -e "s/ &/ |/g" \
# $i >tmp.rnc
#
# $TRANG tmp.rnc tmp.dtd 2>> trang.txt
#
#
# sed -e "s/Signature ..#PCDATA..../Signature (OMOBJ)/" \
# -e "s/CDSignatures .CDSComment./CDSignatures (CDSComment/" \
# -e "s/:ns1//g" \
# -e "s/ns1://g" \
# -e "s/<!-- OMDTD -->/<!ENTITY % omdtd SYSTEM \"openmath2.dtd\"> %omdtd;/"\
# tmp.dtd > ${i%%rnc}dtd
# sed -e "s/</\</g" ${i%%rnc}dtd > ${i%%.rnc}dtd.xml
#
#
# done
echo single page html5
$XSLT -strip:none -dtd:on omstd20.xml omstd20.xsl html5=yes prefix=omstd20 draft=$DRAFT date=$DATE
echo html diff version
$XSLT omstd20.xml omstd20.xsl showdiffs=true html5=yes prefix=omstd20-diff draft=$DRAFT date=$DATE
# old pmathml.xsl rendering doesn't work in current browsers
# echo html
# $XSLT -dtd:on -o:omstd20html.xml omstd20.xml omstd20.xsl
# currently doesn't work and probably not required
# echo chunked html
# $XSLT omstd20.xml omstd20.xsl chunk="true"
# old pmathml.xsl rendering doesn't work in current browsers
# echo html-diff
# $XSLT -o:omstd20html-diff.xml omstd20.xml omstd20.xsl showdiffs=true
echo tex
export SOURCE_DATE_EPOCH=1498228223 # 2017/06/23 date +'%s'
export FORCE_SOURCE_DATE=1
export SOURCE_DATE_EPOCH_TEX_PRIMITIVES=1 # old version
$XSLT -strip:none -o:omstd20.tex omstd20.xml omstd20tex.xsl draft=$DRAFT date=$DATE
echo tex-diff
$XSLT -strip:none -o:omstd20-diff.tex omstd20.xml omstd20tex.xsl showdiffs=true draft=$DRAFT date=$DATE
export PATH=/tmp/texlive/bin/x86_64-linux:$PATH
echo pdf
pdflatex \\batchmode \\input omstd20.tex
if (grep -i rerun omstd20.log)
then
pdflatex \\batchmode \\input omstd20.tex
if (grep -i rerun omstd20.log)
then
pdflatex \\batchmode \\input omstd20.tex
if (grep -i rerun omstd20.log)
then
pdflatex \\batchmode \\input omstd20.tex
fi
fi
fi
echo pdf-diff
pdflatex \\batchmode \\input omstd20-diff.tex
if (grep -i rerun omstd20-diff.log)
then
pdflatex \\batchmode \\input omstd20-diff.tex
if (grep -i rerun omstd20-diff.log)
then
pdflatex \\batchmode \\input omstd20-diff.tex
if (grep -i rerun omstd20-diff.log)
then
pdflatex \\batchmode \\input omstd20-diff.tex
fi
fi
fi
echo zip
rm tmp.*
zip -q om20.zip omstd*.html o*.xml *.dtd [opv][me]*.xsl *.rnc *.rng *.xsd o*.pdf *.png *.ocd run docbook
if [ -d "../OpenMath.github.io/standard/om20-editors-draft" ]
then
echo copying documents to ../OpenMath.github.io/standard/om20-editors-draft
cp omstd20.html omstd20-diff.html omstd20.pdf omstd20-diff.pdf \
../OpenMath.github.io/standard/om20-editors-draft
else
if [ -d "/tmp/texlive" ]; then
echo "travis job push to om website"
rm -rf OpenMath.github.io.git
echo clone
git config --global user.email "[email protected]"
git config --global user.name "Travis CI"
git clone https://[email protected]/OpenMath/OpenMath.github.io.git
cp omstd20.html omstd20-diff.html omstd20.pdf omstd20-diff.pdf \
OpenMath.github.io/standard/om20-editors-draft
cd OpenMath.github.io
git commit -a -m "from travis ci: $TRAVIS_COMMIT_MESSAGE" || echo no changes
git push
else
echo skipping copying to website
fi
fi