-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.sh
executable file
·85 lines (74 loc) · 1.69 KB
/
generate.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
#!/bin/bash
set -euo pipefail
INPUT="README.md"
CONFIG="wr-metadata.yaml"
OUTPUT="output.pdf"
help () {
cat << EOF
Usage: generate.sh [OPTION]...
-h --help Display this message
-p --packages Install necessary packages first
-s --submodules Fetch all necessary submodules for pdf generation
-i --input Specify input markdown file
-c --config Specify input configuration file
-o --output Specify output pdf file
EOF
exit 0;
}
install () {
sudo apt install texlive-full pandoc pandoc-citeproc npm -y
sudo npm i -g mermaid-filter || echo "Error downloading mermaid-filter"
}
fetch_submodule () {
if [ ! -d "wut-thesis-pandoc" ]; then
git submodule add https://github.com/mRokita/wut-thesis-pandoc.git wut-thesis-pandoc
fi
git submodule update --init --recursive
}
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
help
;;
-s|--submodule)
fetch_submodule
shift
;;
-p|--packages)
install
shift
;;
-i|--input)
INPUT="$2"
shift
shift
;;
-c|--config)
CONFIG="$2"
shift
shift
;;
-o|--output)
OUTPUT="$2"
shift
shift
;;
esac
done
mkdir -p output/
cp -r modified/ include/
cp -rn ./wut-thesis-pandoc/include/ ./
pandoc $INPUT \
--verbose \
--standalone \
--syntax-definition include/python.xml \
--biblatex -o output/$OUTPUT \
--listings \
--highlight=tango \
--metadata-file=$CONFIG \
--pdf-engine=latexmk \
--from markdown \
-F mermaid-filter \
--template include/wut-template.tex
rm -rf ./include/
rm mermaid-filter.err