2020-01-15 19:04:42 -08:00
|
|
|
#!/bin/bash
|
2020-01-16 16:39:01 -08:00
|
|
|
PANDOC_PATH=/home/pi/pandoc_src/bin/
|
2020-01-15 19:04:42 -08:00
|
|
|
MAKEFILE=Makefile
|
|
|
|
OUTPUT_FILENAME='offline/Speeduino_manual.pdf'
|
2020-01-16 16:39:01 -08:00
|
|
|
METADATA='offline/metadata.yaml'
|
2020-01-15 19:04:42 -08:00
|
|
|
DEFINITION='offline/std_manual.md'
|
2020-01-16 16:39:01 -08:00
|
|
|
BUILD='/home/pi/book/tmp'
|
|
|
|
CHAPTERS=`tail -n +8 ${DEFINITION}`
|
2020-01-15 19:04:42 -08:00
|
|
|
IMAGES_FOLDER="img"
|
|
|
|
IMAGES=${IMAGES_FOLDER}/*
|
|
|
|
COVER_IMAGE=${IMAGES_FOLDER}/Speeduino\ logo.png
|
|
|
|
TEMPLATE=offline/eisvogel.tex
|
2020-01-16 16:39:01 -08:00
|
|
|
TEMPLATE_OPTIONS='--listings --toc --toc-depth=2'
|
|
|
|
METADATA_ARG=--metadata-file=${METADATA}
|
|
|
|
ARGS="${TEMPLATE_OPTIONS} --template=${TEMPLATE}"
|
|
|
|
#ARGS="${TEMPLATE_OPTIONS}"
|
|
|
|
#PDF_ARGS="--pdf-engine=xelatex"
|
2020-01-16 17:56:38 -08:00
|
|
|
PDF_ARGS="-f markdown-markdown_in_html_blocks --pdf-engine=xelatex --metadata date=`date +%D`"
|
2020-01-15 19:04:42 -08:00
|
|
|
|
|
|
|
#This contains all the fonts that might be needed
|
|
|
|
#sudo apt-get install texlive-fonts-extra
|
|
|
|
|
2020-01-16 16:39:01 -08:00
|
|
|
CUR_PATH=`pwd`
|
|
|
|
mkdir -p ${BUILD}
|
|
|
|
cd ${BUILD}
|
|
|
|
git clone --depth=1 https://github.com/speeduino/wiki.js.git
|
|
|
|
cd wiki.js
|
|
|
|
|
|
|
|
#Add a blank line on the top of each file to prevent issues with pandoc concatenation
|
|
|
|
for f in ${CHAPTERS}
|
|
|
|
do
|
|
|
|
sed -s -i '1i\\' $f
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
echo ${PANDOC_PATH}pandoc ${ARGS} ${PDF_ARGS} -o ${OUTPUT_FILENAME} ${CHAPTERS}
|
|
|
|
${PANDOC_PATH}pandoc ${ARGS} ${PDF_ARGS} -o ${OUTPUT_FILENAME} ${CHAPTERS}
|
|
|
|
|
|
|
|
#Copy the produced PDF back to the main directory
|
|
|
|
cp ${OUTPUT_FILENAME} ${CUR_PATH}/offline
|
2020-01-15 19:04:42 -08:00
|
|
|
# @echo "$@ was built"
|
|
|
|
|
2020-01-16 16:39:01 -08:00
|
|
|
|
|
|
|
#Cleanup
|
|
|
|
cd ${BUILD}/..
|
2020-01-16 17:56:38 -08:00
|
|
|
#rm -rf ./tmp
|
2020-01-16 16:39:01 -08:00
|
|
|
cd ${CUR_PATH}
|