forked from oasis-tcs/virtio-spec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makediffhtml.sh
executable file
·55 lines (43 loc) · 1.68 KB
/
makediffhtml.sh
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
#!/bin/sh
./makediff.sh virtio-html.tex || exit 3
SPECDOC=${SPECDOC:-`cat REVISION`}
FROMVERSION=${FROMVERSION:-`cat DIFFVERSION`}
SPECDOC="${SPECDOC}-diff-from-${FROMVERSION}"
./make-setup-generated.sh "$SPECDOC"
cp virtio-diff.tex $SPECDOC.tex
#uncomment if you have a broken t4ht
#PATH=./t4ht-workaround:${PATH} htlatex $SPECDOC.tex "virtiohtml,info,charset=utf-8" " -cunihtf -utf8"
htlatex $SPECDOC.tex "virtio-html,info,charset=utf-8,fn-in" " -cunihtf -utf8"
rm $SPECDOC.tex
rm $SPECDOC.aux
mv $SPECDOC.html $SPECDOC.tmp1
sed 's/~~/"/g' $SPECDOC.tmp1 >$SPECDOC.tmp2
sed 's/>~/>"/g' $SPECDOC.tmp2 >$SPECDOC.tmp3
sed 's/>=~/>="/g' $SPECDOC.tmp3 >$SPECDOC.tmp4
sed 's/~</"</g' $SPECDOC.tmp4 >$SPECDOC.tmp5
# If font paths are misconfigured, we get ligatures
# (such as 'ff or 'fi') replaced by NULL character in output.
# This in not a valid HTML output, so detect this and warn user.
# For detection, we rely on the fact that file utility
# recognizes files with NULL characters as binary data.
if test "$(file -b $SPECDOC.tmp5)" = 'data';
then
echo
echo WARNING!
echo
echo NULL characters detected in file output.
echo This is likely due to tex4ht being unable to find font files.
echo If installed, you might need to fix font file paths
echo for tex4ht by locating tex4ht.env file in your setup
echo correcting font file paths there and copying it to
echo tex4ht.env or .tex4ht in your home directory.
echo
echo WARNING!
echo Proceeding but HTML output appears to be malformed.
echo
fi
mv $SPECDOC.tmp5 $SPECDOC.html
rm $SPECDOC.tmp*
#uncomment if you have a broken t4ht
#cp ./t4ht-workaround/virtio-v1.0-csd01.css $SPECDOC.css
zip $SPECDOC.zip $SPECDOC*.html $SPECDOC.css images/*.png