summaryrefslogtreecommitdiff
path: root/build.sh
diff options
context:
space:
mode:
authorAntoine Ouvrard <antoine.ouvrard@nereide.fr>2021-05-28 20:03:42 +0200
committerAntoine Ouvrard <antoine.ouvrard@nereide.fr>2021-05-31 16:01:18 +0200
commita6dd3c53e4c512bbc2077ce1870cb8c3d8256268 (patch)
treea3dcf03477ac7a01112bb9997ac016e654d01351 /build.sh
parentc47a1cd61943a182408ef62e35d291142675a5bf (diff)
mise a jour CV
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..bbb3a8a
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+while [ -n "$1" ]; do # gestion des paramètres
+ case "$1" in
+ -h) echo "Script qui transforme des fichiers markdown en pdf et html avec le même style.
+-k conserve les fichiers de construction"; exit 0;;
+ -k) keep=true;;
+ esac
+ shift
+done
+
+set -xe
+IN_DIR="./input-cv-md"
+OUT_DIR="./output"
+STYLES_DIR="styles"
+STYLE="aou"
+
+mkdir -p $IN_DIR
+mkdir -p $OUT_DIR
+
+for f in $IN_DIR/*.md; do
+ FILE_NAME=`basename $f | sed 's/.md//g'`;
+ # Génère le HTML
+ pandoc --standalone --css ../$STYLES_DIR/$STYLE.css \
+ --from markdown --to html \
+ --output $OUT_DIR/$FILE_NAME.html $f \
+ --metadata pagetitle=$FILE_NAME;
+ # Génère le PDF
+ pandoc --standalone --template $STYLES_DIR/$STYLE.tex \
+ --from markdown --to context --variable papersize=A4 \
+ --output $OUT_DIR/$FILE_NAME.tex $f;
+ mtxrun --path=$OUT_DIR --result=$FILE_NAME.pdf --script context $FILE_NAME.tex;
+done
+
+if [ -z "$keep" ] ; then
+ rm -rf $OUT_DIR/*.log $OUT_DIR/*.tex $OUT_DIR/*.tuc styles/*.pdf;
+fi