-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·121 lines (102 loc) · 3.42 KB
/
build.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
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
#!/bin/bash
build_count() {
if [ ! -z $build_count_server ]; then
wget -qO build.txt http://$build_count_server/CST-Live-Guide
else echo LOCAL > build.txt
fi
cat build.txt
}
maketex() {
mkdir build$1
pdflatex --shell-escape -synctex=1 --interaction=nonstopmode -output-directory=build${1%/} ."$1"/"$2".tex
}
makemd() {
mkdir build$1
pandoc -t latex -o build${1%/}/"$2".pdf ."$1"/"$2".md
}
makepreamble() {
mkdir build
(
exec 1> build/book.tex
echo "\documentclass[12pt, a4paper, utf8]{book}"
echo ""
echo "\usepackage{subfiles}"
echo "\usepackage{CJKutf8}"
echo "\usepackage{longtable}"
echo "\usepackage{booktabs}"
echo "\usepackage[colorlinks=true, urlcolor=blue, pdfauthor={JNU 2015 CS}, pdftitle={CST Live Guide}, pdfsubject={CST Live Guide}, pdfkeywords={Computer Science}, pdfproducer={LaTeX}, pdfcreator={pdflatex, pandoc}]{hyperref}"
echo ""
echo "\providecommand{\tightlist}{\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}"
echo ""
echo "\begin{document}"
echo "\begin{CJK}{UTF8}{gkai}"
echo "\pagenumbering{gobble}"
)
}
makefinal() {
(
exec 1>> build/book.tex
echo "\newpage"
echo "\end{CJK}"
echo "\end{document}"
)
maketex /build book
maketex /build book
retval=$?
git clone --depth=1 https://github.com/CSTGit/CST-Live-Guide.git -b web output
cp build/build/book.pdf output/
return $retval
}
includetex() {
echo "\subfile{\"${1#/}$2\"}" >> build/book.tex
}
includemd() {
mkdir build/"${1#/}"
pandoc "${1#/}$2".md -t latex -o build/"${1#/}""$2".tex
echo "\subfile{\"build/${1#/}$2\"}" >> build/book.tex
}
build_count
# Preamble
rm -r build
rm -rf output
makepreamble
# Write book
includetex / cover
echo "\tableofcontents" >> build/book.tex
echo "\newpage" >> build/book.tex
echo "\pagenumbering{arabic}" >> build/book.tex
includetex "Basic Math/" ChapterIntro
includetex "Basic Math/" NumeralSystem
includetex "Basic Math/" Arithmetic
includetex "Basic Math/" BooleanAlgebra
includetex "Basic Math/" AxiomAndTheorem
includetex "Data Structure/" ChapterIntro
includetex "Data Structure/" IntegerRepresentation
includetex "Data Structure/" DecimalRepresentation
includetex "Data Structure/" CharacterEncoding
includetex "Data Structure/" DataOrganization
includetex "Data Communication/" ChapterIntro
includetex "Data Communication/" InterProcessCommunication
includetex "Hardware Execution/" ChapterIntro
includetex "Hardware Execution/" LogicGate
includetex "Hardware Execution/" GateCircuits
includetex "Hardware Execution/" CPUExecution
includetex "Hardware Execution/" ExecutionFlowModification
includetex "Compiler Principle/" ChapterIntro
includetex "Compiler Principle/" ChomskyHierarchy
includetex "Compiler Principle/" AutomataTheory
includetex "Compiler Principle/" CodeGeneration
includetex "Compiler Principle/" ProgramOptimization
includetex "Deep Learning/" ChapterIntro
includemd "Deep Learning/" Classification
includemd "Deep Learning/" ObjectDetection
includemd "Deep Learning/" SemanticSegmentation
includemd "Deep Learning/" InstanceSegmentation
includemd "Deep Learning/" MobileNetwork
includemd "Deep Learning/" SearchNetwork
includetex "Real World Develop/" ChapterIntro
includetex "Real World Develop/" HealthAdvice
includetex "Sentimental Life/" ChapterIntro
includetex "Sentimental Life/" blank
# End
makefinal