blob: 0f80bb41eb75faae84fbe023ac80d256cd4a0ff9 (
plain)
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
|
#!/bin/bash
# quick latex writer test runner
# $Id$
echo "THIS is not updated in normal commits"
CHECKS=0
FAILS=0
FAIL_QUEUE=""
function do_diff() {
CHECKS=$((CHECKS + 1))
diff -q -s $1 $2
if test $? -gt 0 ; then
FAILS=$((FAILS + 1))
FAIL_QUEUE="$FAIL_QUEUE,$1"
fi
}
function report() {
echo "-------------------------------------"
if test $FAILS -eq 0 ; then
echo "OK: all $CHECKS tests passed"
else
echo "ERROR: $FAILS of $CHECKS failed"
echo "Failed tests: $FAIL_QUEUE"
fi
}
BARE_CMD="../../docutils/tools/rst2latex.py --traceback "
BASE_CMD="$BARE_CMD --stylesheet= "
CMD="$BASE_CMD"
if [ -z "$1" ] ; then
FM="*.txt"
else
FM=$1
fi
for INF in `ls test/$FM` ; do
OUTF="$INF.tex"
REFF="$OUTF.ref"
OPT=""
if [ $INF = "test/unicode-box.txt" ] ; then
OPT="-o utf-8:strict"
fi
$CMD $OPT $2 $3 $INF > $OUTF
do_diff $REFF $OUTF
done
if [ -n "$1" -a ! "$1" == "-" ] ; then
report
exit
fi
# stylesheet embedding
#
# fail for no extension
INF=test/header.txt
STF=test/dummy_stylesheet
echo -e "% dummy stylesheet\n% second line" > $STF
OUTF="$INF-embed-stylesheet.err"
REFF="$OUTF.ref"
$CMD --stylesheet-path=$STF --embed-stylesheet $2 $3 $INF > $OUTF 2>&1
do_diff $REFF $OUTF
# embed for .inc
mv $STF $STF.inc
OUTF="$INF-embed-stylesheet.tex"
REFF="$OUTF.ref"
$CMD --stylesheet-path=$STF.inc --embed-stylesheet $2 $3 $INF > $OUTF 2>&1
do_diff $REFF $OUTF
# embed for .sty
mv $STF.inc $STF.sty
OUTF="$INF-embed-stylesheet-sty.tex"
REFF="$OUTF.ref"
$CMD --stylesheet-path=$STF.sty --embed-stylesheet $2 $3 $INF > $OUTF 2>&1
do_diff $REFF $OUTF
exit
INF=test/header.txt
for GO in "" auto pdftex dvips,300dpi ; do
OUTF="$INF-graphicx-option-$GO.tex"
REFF="$OUTF.ref"
$CMD --graphicx-option=$GO $2 $3 $INF > $OUTF
do_diff $REFF $OUTF
done
# font encoding
for FONTENC in "" T1 OT1 ; do
for INF in `ls test/characters.txt` ; do
OUTF="$INF-$FONTENC.tex"
REFF="$OUTF.ref"
if [ -z $FONTENC ] ; then
$CMD $2 $3 $INF > $OUTF
else
$CMD --font-encoding=$FONTENC $2 $3 $INF > $OUTF
fi
do_diff $REFF $OUTF
done
done
# reference-label
for LR in "" "ref" ; do
for INF in test/links.txt ; do
OUTF="$INF-$LR.tex"
REFF="$OUTF.ref"
$CMD --reference-label=$LR $2 $3 $INF > $OUTF
do_diff $REFF $OUTF
done
done
INF="test/tables.txt"
OUTF="$INF-verbatim.tex"
REFF="$OUTF.ref"
$CMD --use-verbatim-when-possible $2 $3 $INF > $OUTF
do_diff $REFF $OUTF
INF="test/tables.txt"
OUTF="$INF-literal-block-env.tex"
REFF="$OUTF.ref"
$CMD --literal-block-env="lstlisting[language=Python]" $2 $3 $INF > $OUTF
do_diff $REFF $OUTF
# table-style
for TABSTYLE in "" standard booktabs nolines ; do
for INF in `ls test/tables.txt` ; do
OUTF="$INF-$TABSTYLE.tex"
REFF="$OUTF.ref"
if [ -z $TABSTYLE ] ; then
$CMD $2 $3 $INF > $OUTF
else
$CMD --table-style=$TABSTYLE $2 $3 $INF > $OUTF
fi
do_diff $REFF $OUTF
done
done
INF=test/sections.txt
OUTF="$INF-parts.tex"
REFF="$OUTF.ref"
$CMD --use-part-section $2 $3 $INF > $OUTF
do_diff $REFF $OUTF
# rowspan tables
INF=test/tables-multirow.txt
OUTF="$INF.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
# with generated footer
INF=test/docinfo.txt
OUTF="$INF-gs.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
CMD="$BASE_CMD --documentclass=book"
INF=test/docinfo.txt
OUTF="$INF-book.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
CMD="$BASE_CMD --documentclass=custom"
INF=test/docinfo.txt
OUTF="$INF-custom.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
CMD="$BASE_CMD --no-doc-info"
INF=test/docinfo.txt
OUTF="$INF-no-info.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
CMD="$BASE_CMD --no-doc-title"
INF=test/docinfo.txt
OUTF="$INF-no-title.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
CMD="$BASE_CMD --no-doc-title --no-doc-info"
INF=test/docinfo.txt
OUTF="$INF-no-title-info.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
CMD="$BASE_CMD --use-titlepage-env"
for F in docinfo docinfo-1 docinfo-2 docinfo-3 ; do
INF=test/$F.txt
OUTF="$INF-use-titlepage-env.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
done
CMD="$BASE_CMD --use-latex-abstract --use-titlepage-env"
for F in docinfo-2 docinfo-3 ; do
INF=test/$F.txt
OUTF="$INF-use-titlepage-env-latexabstract.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
done
CMD="$BASE_CMD --use-latex-abstract"
F=docinfo-2
INF=test/$F.txt
OUTF="$INF-use-latex-abstract.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
CMD="$BASE_CMD --use-latex-docinfo"
for F in docinfo docinfo-2 ; do
INF=test/$F.txt
OUTF="$INF-use-latex-docinfo.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
done
CMD="$BASE_CMD"
# with latex toc
for F in toc toc-autonr ; do
INF=test/$F.txt
OUTF="$INF-use-latex-toc.tex"
REFF="$OUTF.ref"
$CMD --use-latex-toc $INF > $OUTF
do_diff $REFF $OUTF
done
# german
for F in toc quotes ; do
for L in de fr it ; do
INF=test/$F.txt
OUTF="$INF-$L.tex"
REFF="$OUTF.ref"
$CMD -l $L $INF > $OUTF
do_diff $REFF $OUTF
done
done
# spanish --language=es flags inhibits --use-latex-docinfo when using
# --documentclass=book and --use-latex-toc
CMD="$BASE_CMD --documentclass=book --use-latex-toc --use-latex-docinfo"
for F in toc quotes ; do
INF=test/$F.txt
OUTF="$INF-latex-docinfo.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
LANG=es
do_diff $REFF $OUTF
OUTF="$INF-$LANG-latex-docinfo.tex"
REFF="$OUTF.ref"
$CMD --language=$LANG $INF > $OUTF
do_diff $REFF $OUTF
done
# use latex footnotes
CMD="$BASE_CMD --use-latex-footnotes"
INF=test/footnotes.txt
OUTF="$INF-use-latex-footnotes.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
# use latex citations
CMD="$BASE_CMD --use-latex-citations"
for F in footnotes.txt no-citations.txt citation_labels.txt ; do
INF=test/$F
OUTF="$INF-use-latex-citations.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
done
# use bibtex
INF=test/citations.txt
CMD="$BASE_CMD --use-latex-citations --use-bibtex=mystyle,mydb1,mydb2"
OUTF="$INF-use-bibtex.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
CMD="$BASE_CMD --use-verbatim-when-possible"
INF=test/literal.txt
OUTF="$INF-use-verbatim-when-possible.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
for L in en de es ; do
CMD="$BASE_CMD "
INF=test/literal.txt
OUTF="$INF-$L.tex"
REFF="$OUTF.ref"
$CMD --lang=$L $INF > $OUTF
do_diff $REFF $OUTF
OUTF="$INF-$L-verb.tex"
REFF="$OUTF.ref"
$CMD --use-verbatim-when-possible --language=$L $INF > $OUTF
do_diff $REFF $OUTF
done
report
echo "CHECK: toc with latex toc "
exit
# lost test files.
INF=test/kasten.txt
OUTF="$INF-de.tex"
REFF="$OUTF.ref"
$CMD -l de $INF > $OUTF
do_diff $REFF $OUTF
CMD="$BASE_CMD --attribution=parens"
INF=test/attribution.txt
OUTF="$INF-parens-attribution.tex"
REFF="$OUTF.ref"
$CMD $INF > $OUTF
do_diff $REFF $OUTF
INF=test/iso-8859-15.txt
OUTF="$INF-enc.tex"
REFF="$OUTF.ref"
$CMD --input-encoding=iso-8859-15 --output-encoding=iso-8859-15 $INF > $OUTF
do_diff $REFF $OUTF
|