manuals/build-pandoc.sh
Julien Fastré 4c330d7b87
Some checks failed
continuous-integration/drone/push Build is failing
Build and Push MkDocs Docker Image / build-and-push (push) Successful in 2m40s
Publier la documentation de Chill en ligne après chaque mise à jour (#14)
Reviewed-on: #14
Co-authored-by: Julien Fastré <julien.fastre@champs-libres.coop>
Co-committed-by: Julien Fastré <julien.fastre@champs-libres.coop>
2025-06-30 16:16:24 +00:00

91 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
set -e
# enter the current directory
cd "$(dirname $0)"
export PANDOC_DIR="$(pwd)/pandoc/cl"
export OUTPUT_DIR="$(pwd)"
if [ -z $1 ]; then
export target=pdf
else
export target=$1
fi
if [ -z $2 ]; then
export kind=user
else
export kind=$2
fi
if [ $kind = 'user' ]; then
export files="
intro.md
concept.md
interface.md
search.md
person.md
person-vendee.md
activite.md
document.md
thirdparty.md
menage.md
parcours.md
social_actions.md
notifications.md
tasks.md
workflows.md
adresses.md
exports.md
exports_person.md
exports_activity.md
exports_accompanying_period.md
nouveautes.md
"
# missing pages to once completed
# exports_accompanying_period_work.md
# exports_accompanying_period_work_evaluation.md
# exports_aside_activity.md
# exports_calendar.md
# exports_household.md
elif [ $kind = 'admin' ]; then
export files="
start.md
generation-documents.md
"
else
echo "kind '$kind' is not valid";
exit 1;
fi
export PDF_TEMPLATE="$(pwd)/eisvogel.latex"
cd $kind/docs
export ARGS="
--from markdown
--number-sections
--resource-path ./.
--metadata-file ./metadata.yaml
"
export LATEX_ARGS="
--metadata=footer-left:$(date +%d-%m-%Y)
--template ${PDF_TEMPLATE}
--lua-filter "${PANDOC_DIR}/boxes.lua"
"
if [ $target = "latex" ]; then
pandoc $ARGS $LATEX_ARGS \
--to latex \
$files;
elif [ $target = "pdf" ]; then
pandoc $ARGS $LATEX_ARGS \
--to pdf \
--pdf-engine xelatex \
-o "${OUTPUT_DIR}/$kind-manual.pdf" \
$files
fi