-
Notifications
You must be signed in to change notification settings - Fork 4
/
build_all_final.sh
58 lines (49 loc) · 1.59 KB
/
build_all_final.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
56
57
58
#!/bin/bash
for filename in part/*.wik
do
echo !!! processing $filename ...
pandoc $filename -f mediawiki -t latex --standalone -o ${filename%.*}.tex
echo ... converted $filename to TeX.
done
for filename in section/*.wik
do
echo !!! processing $filename ...
pandoc $filename -f mediawiki -t latex --standalone -o ${filename%.*}.tex
echo ... converted $filename to TeX.
done
if [ "$(ls part/*.tex)" ]; then
for filename in part/*.tex
do
echo !!! processing $filename ...
title=$(sed -n '1p' $filename)
sed -i '' -e '1,2d' $filename
sed -i '' -e 's/\\end{document}//g;s/\\label.*}//g;s/\\\tightlist//g' $filename
sed -i '' -e 's/\\section/\\part/g;s/\\subsection/\\section/g;s/\\subsubsection/\\subsection/g' $filename
python3 convert_tex_to_html.py > ${filename%.*}.html -f $filename -P -F -T "$title" | sed 's/ /\\ /g'
echo ... converted $filename to HTML.
done
fi
if [ "$(ls section/*.tex)" ]; then
for filename in section/*.tex
do
echo !!! processing $filename ...
title=$(sed -n '1p' $filename)
sed -i '' -e '1,2d' $filename
sed -i '' -e 's/\\end{document}//g;s/\\label.*}//g;s/\\\tightlist//g' $filename
sed -i '' -e '1s/^/\\part{}\
/' $filename
python3 convert_tex_to_html.py > ${filename%.*}.html -f $filename -F -T "$title" | sed 's/ /\\ /g'
echo ... converted $filename to HTML.
done
fi
mkdir -p final
echo !!! moving files ...
for filename in part/*.html
do
mv $filename final/
done
for filename in section/*.html
do
mv $filename final/
done
echo ... files 'in' final.