-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun
executable file
·275 lines (218 loc) · 7.17 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
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
set -e
# http://saxon.sourceforge.net/
if [ -f saxon-he.jar ]; then
export XSLT="java -jar ../saxon-he.jar -versionmsg:off "
else
export XSLT="java -jar /tmp/jars/saxon-he.jar -versionmsg:off "
fi
# https://code.google.com/archive/p/jing-trang/downloads
if [ -f saxon-he.jar ]; then
export TRANG="java -jar ../trang.jar "
else
export TRANG="java -jar /tmp/jars/trang.jar "
fi
if [ "$1" == "final" ]
then
DRAFT=no
TARGET=om20-2019-07-01
shift
else
DRAFT=yes
TARGET=om20-editors-draft
fi
case "$TRAVIS_COMMIT_MESSAGE" in
\[ci\ final\]*)
DRAFT=no
TARGET=om20-2019-07-01
esac
echo TARGET=$TARGET
# check validity
# back this out for now
# xmllint --noout --loaddtd --valid omstd20.xml
DATE=`date "+%Y-%m-%d"`
if [ ! -d build ] ; then
echo "make build directory"
mkdir build 2> /dev/null
else
echo "dont make build directory"
fi
cp *.rnc xsl/*.xsl png/*.png *.ocd *.sts *.cdg build
# cp support/rnc2dbk build
cp openmath.cls build
# copy over json + d.ts files for OpenMath JSON
cp openmath2.d.ts openmath2.json build
cd build
# 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
# dos2unix
tr -d '\r' < ${i%%rnc}rng > ${i%%rnc}rng-
mv ${i%%rnc}rng- ${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
# dos2unix
tr -d '\r' < ${i%%rnc}xsd > ${i%%rnc}xsd-
mv ${i%%rnc}xsd- ${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/(CDSReviewDate[?] & CDSStatus)/((CDSReviewDate,CDSStatus)|(CDSStatus,CDSReviewDate?))/g" \
$i >tmp.rnc
$TRANG tmp.rnc tmp.dtd 2>> trang.txt
sed -e "s/Signature ..#PCDATA..../Signature (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
for i in omcd2.rnc omcdsig2.rnc omcdgroup2.rnc openmath2.rnc
do
# dos2unix
tr -d '\r' < ${i%%rnc}dtd > ${i%%rnc}dtd-
mv ${i%%rnc}dtd- ${i%%rnc}dtd
done
echo single page html5
$XSLT -strip:none ../omstd20.xml omstd20.xsl html5=yes prefix=omstd20 draft=$DRAFT date=$DATE
echo html diff version
$XSLT -strip:none ../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 ||(echo "ERROR in TeX"; cat omstd20.log; false)
if (grep -i ' rerun ' omstd20.log)
then
pdflatex \\batchmode \\input omstd20.tex ||(echo "ERROR in TeX"; cat omstd20.log;false)
if (grep -i ' rerun ' omstd20.log)
then
pdflatex \\batchmode \\input omstd20.tex ||(echo "ERROR in TeX"; cat omstd20.log;false)
if (grep -i ' rerun ' omstd20.log)
then
pdflatex \\batchmode \\input omstd20.tex ||(echo "ERROR in TeX"; cat omstd20.log;false)
fi
fi
fi
cat omstd20.log
echo pdf-diff
pdflatex \\batchmode \\input omstd20-diff.tex ||(echo "ERROR in TeX"; cat omstd20-diff.log;false)
if (grep -i ' rerun ' omstd20-diff.log)
then
pdflatex \\batchmode \\input omstd20-diff.tex ||(echo "ERROR in TeX"; cat omstd20-diff.log;false)
if (grep -i ' rerun ' omstd20-diff.log)
then
pdflatex \\batchmode \\input omstd20-diff.tex ||(echo "ERROR in TeX"; cat omstd20-diff.log;false)
if (grep -i ' rerun ' omstd20-diff.log)
then
pdflatex \\batchmode \\input omstd20-diff.tex ||(echo "ERROR in TeX"; cat omstd20-diff.log;false)
fi
fi
fi
echo zip
rm tmp.*
zip -q om20.zip omstd*.html o*.xml *.dtd [opv][me]*.xsl *.rnc *.rng *.xsd *.json *.d.ts o*.pdf *.png *.ocd run
if [ "$1" = "copy" ] && [ -d "../../OpenMath.github.io/standard/$TARGET" ]
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/$TARGET
cp {omcd2,omcdsig2,omcdgroup2,openmath2}.{rnc,rng,xsd,dtd} \
../../OpenMath.github.io/standard/$TARGET
else
if [ "$TRAVIS" = "true" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then
echo "travis job push to om website"
rm -rf OpenMath.github.io
echo clone
git config --global user.email "[email protected]"
git config --global user.name "Travis CI"
git config --global push.default simple
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/$TARGET
cp {omcd2,omcdsig2,omcdgroup2,openmath2}.{rnc,rng,xsd,dtd} \
OpenMath.github.io/standard/$TARGET
cd OpenMath.github.io
NEW_MSG=`echo "$TRAVIS_COMMIT_MESSAGE" | sed -e 's/#/iss./g' -e 's/[*?]//g'`
git commit -a -m "from travis ci: $NEW_MSG" || echo no changes
git push
else
echo skipping copying to website
fi
fi