From e389c8736bc54ba95be07d25804d1d2ce838d38f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Wed, 25 Aug 2021 17:46:54 +0200 Subject: [PATCH] add admin manual in same repo --- .drone.yml | 6 +++-- .gitignore | 2 +- admin/generation-documents.md | 4 ++++ admin/metadata.yaml | 10 +++++++++ build-pandoc.sh | 34 ++++++++++++++++++++++------- metadata.yaml => user/metadata.yaml | 0 {src => user}/parcours.md | 0 7 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 admin/generation-documents.md create mode 100644 admin/metadata.yaml rename metadata.yaml => user/metadata.yaml (100%) rename {src => user}/parcours.md (100%) diff --git a/.drone.yml b/.drone.yml index d2574bc..fb5525d 100644 --- a/.drone.yml +++ b/.drone.yml @@ -16,8 +16,8 @@ steps: - name: pandoc image: pandoc/alpine:2.14 commands: - - ls - - sh build-pandoc.sh latex > user-manual.tex + - sh build-pandoc.sh latex user > user-manual.tex + - sh build-pandoc.sh latex admin > user-manual.tex when: event: tag @@ -25,6 +25,7 @@ steps: image: ghcr.io/xu-cheng/texlive-full:latest commands: - latexmk -pdf -file-line-error -halt-on-error -interaction=nonstopmode -xelatex user-manual.tex + - latexmk -pdf -file-line-error -halt-on-error -interaction=nonstopmode -xelatex latex-manual.tex when: event: tag @@ -36,6 +37,7 @@ steps: base_url: https://gitea.champs-libres.be files: - user-manual.pdf + - admin-manual.pdf checksum: - sha512 title: ${DRONE_COMMIT_REF} diff --git a/.gitignore b/.gitignore index 7620ceb..51b6bae 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ build/* -user-manual.* +*-manual.pdf diff --git a/admin/generation-documents.md b/admin/generation-documents.md new file mode 100644 index 0000000..9c0dcda --- /dev/null +++ b/admin/generation-documents.md @@ -0,0 +1,4 @@ + +# test + +oui diff --git a/admin/metadata.yaml b/admin/metadata.yaml new file mode 100644 index 0000000..5f16f02 --- /dev/null +++ b/admin/metadata.yaml @@ -0,0 +1,10 @@ +--- +title: Manuel administrateur de Chill +subtitle: Chill en Vendée +lang: fr-BE +toc: true + + +header-includes: | + \usepackage{awesomebox} +... diff --git a/build-pandoc.sh b/build-pandoc.sh index 6bcc0e5..b3cee7d 100755 --- a/build-pandoc.sh +++ b/build-pandoc.sh @@ -1,12 +1,11 @@ #!/bin/sh +set -e + # enter the current directory cd "$(dirname $0)" export PANDOC_DIR=pandoc/cl -export files=" - src/parcours.md -" if [ -z $1 ]; then export target=pdf @@ -14,9 +13,28 @@ else export target=$1 fi +if [ -z $2 ]; then + export kind=user +else + export kind=$2 +fi + +if [ $kind = 'user' ]; then + export files=" + $kind/parcours.md + " +elif [ $kind = 'admin' ]; then + export files=" + $kind/generation-documents.md + " +else + echo "kind '$kind' is not valid"; + exit 1; +fi + export ARGS=" --from markdown - --metadata-file ./metadata.yaml + --metadata-file ./$kind/metadata.yaml --lua-filter "${PANDOC_DIR}/format-link.lua" " export PDF_TEMPLATE="./pandoc/template/eisvogel.tex" @@ -26,17 +44,17 @@ export LATEX_ARGS=" " -if [ $target == "latex" ]; then +if [ $target = "latex" ]; then pandoc $ARGS $LATEX_ARGS \ --to latex \ $files; -elif [ $target == "pdf" ]; then +elif [ $target = "pdf" ]; then pandoc $ARGS $LATEX_ARGS \ --to pdf \ --pdf-engine xelatex \ - -o ./user-manual.pdf \ + -o "./$kind-manual.pdf" \ $files -elif [ $target == "html" ]; then +elif [ $target = "html" ]; then # check target directory exists if [ ! -d "./build/html" ]; then echo "create build/html directory" diff --git a/metadata.yaml b/user/metadata.yaml similarity index 100% rename from metadata.yaml rename to user/metadata.yaml diff --git a/src/parcours.md b/user/parcours.md similarity index 100% rename from src/parcours.md rename to user/parcours.md