uni-ausarbeitung/build.sh

94 lines
1.8 KiB
Bash
Raw Normal View History

2020-06-28 21:59:13 +00:00
#!/bin/bash
function run_clean {
latexmk -C
2021-05-16 20:01:36 +00:00
if [ -f out/main.bbl ]
then
2021-05-16 20:01:36 +00:00
rm out/main.bbl
fi
2021-05-16 20:01:36 +00:00
if [ -f out/main.lol ]
then
2021-05-16 20:01:36 +00:00
rm out/main.lol
fi
2021-05-16 20:01:36 +00:00
if [ -f out/main.ptc ]
then
2021-05-16 20:01:36 +00:00
rm out/main.ptc
fi
2021-05-16 20:01:36 +00:00
if [ -f out/main.run.xml ]
then
2021-05-16 20:01:36 +00:00
rm out/main.run.xml
fi
if [ -f chapter/out.tex ]
then
rm chapter/out.md
rm chapter/out.tex
fi
shopt -s nullglob
for f in appendix/generated/*.tex
do
rm $f
done
}
function run_pandoc {
if [ -f chapter/out.tex ]
then
rm chapter/out.md
rm chapter/out.tex
fi
2020-06-28 21:59:13 +00:00
cat chapter/*.md > chapter/out.md
pandoc --lua-filter templates/germanquotes.lua --citeproc --filter pandoc-crossref \
2020-06-28 21:59:13 +00:00
-M cref=true --top-level-division=chapter \
--bibliography library/library.bib --biblatex \
-o chapter/out.tex chapter/out.md
}
2020-06-28 21:59:13 +00:00
function run_latexmk {
2021-05-16 20:01:36 +00:00
latexmk -quiet -latexoption="-shell-escape" -outdir=out main.tex
}
function run_pandoc_appendix {
shopt -s nullglob
for f in appendix/generated/*.tex
do
rm $f
done
for f in appendix/*.md
do
filename=$(basename -- "$f")
filename="${filename%.*}"
pandoc --lua-filter templates/germanquotes.lua --citeproc --filter pandoc-crossref \
-M cref=true --top-level-division=chapter \
--bibliography library/library.bib --biblatex \
-o appendix/generated/$filename.tex appendix/$filename.md
done
}
case $1 in
"clean")
run_clean
;;
"pandoc")
run_pandoc
run_pandoc_appendix
run_latexmk
;;
"latex")
run_latexmk
;;
"appendix")
run_pandoc_appendix
;;
*)
echo $"Usage: $0 {clean|pandoc|latex}"
exit 1
2021-05-16 20:01:36 +00:00
esac