Chill-manuals/build-pandoc.sh

52 lines
939 B
Bash
Raw Permalink Normal View History

2021-07-26 15:52:23 +00:00
#!/bin/sh
2021-07-26 13:11:23 +00:00
# enter the current directory
cd "$(dirname $0)"
export PANDOC_DIR=pandoc/cl
2021-07-26 15:52:23 +00:00
export files="
2021-07-26 13:11:23 +00:00
src/parcours.md
2021-07-26 15:52:23 +00:00
"
2021-07-26 13:11:23 +00:00
if [ -z $1 ]; then
export target=pdf
else
export target=$1
fi
export ARGS="
--from markdown
--metadata-file ./metadata.yaml
--lua-filter "${PANDOC_DIR}/format-link.lua"
"
export PDF_TEMPLATE="./pandoc/template/eisvogel.tex"
export LATEX_ARGS="
--template "${PDF_TEMPLATE}"
--lua-filter "${PANDOC_DIR}/boxes.lua"
"
2021-07-26 13:34:35 +00:00
if [ $target == "latex" ]; then
2021-07-26 13:11:23 +00:00
pandoc $ARGS $LATEX_ARGS \
--to latex \
$files;
elif [ $target == "pdf" ]; then
pandoc $ARGS $LATEX_ARGS \
--to pdf \
--pdf-engine xelatex \
-o ./user-manual.pdf \
$files
elif [ $target == "html" ]; then
# check target directory exists
if [ ! -d "./build/html" ]; then
echo "create build/html directory"
mkdir -p "./build/html"
fi
pandoc $ARGS \
--to html \
-o ./build/html/index.html \
$files
fi