diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2012-07-14 17:44:43 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2012-07-14 17:44:43 +0200 |
commit | 3153217e8553b47e3b1178fbf9c4b85abac1e192 (patch) | |
tree | f97ef512db5724ed3b22114b64d8adeaee4afa45 | |
parent | ec92a515e9229bdf46f5a3da82a453957b85365b (diff) |
new build script using pandoc
-rw-r--r-- | README.txt | 9 | ||||
-rwxr-xr-x | pandoc-build.sh | 73 |
2 files changed, 82 insertions, 0 deletions
@@ -23,6 +23,15 @@ ed odt, e ``<sezione>`` può essere ``esempi`` o ``strumenti``. Alcuni esempi non compilano in tutti i formati supportati da docutils, dato che illustrano caratteristiche non sempre disponibili. +In alternativa, si possono compilare gli esempi con pandoc_, usando:: + + ./pandoc_build.sh [-H] [-l] [-p] [-e] <sezione> [<sezione>] + +anche in questo caso per ottenere PDF è necessario avere installato +xeTeX. + +.. _pandoc: http://johnmacfarlane.net/pandoc/ + Licenza ------- diff --git a/pandoc-build.sh b/pandoc-build.sh new file mode 100755 index 0000000..a15b508 --- /dev/null +++ b/pandoc-build.sh @@ -0,0 +1,73 @@ +#!/bin/bash + +build() +{ + echo "Building $TARGET" + for FMT in $FORMATS + do + mkdir -p build/pandoc/$FMT + OPTS="-f rst" + case $FMT in + "html") OPTS="$OPTS -t html" + EXT=".html" + SPLIT=true;; + "latex") OPTS="$OPTS -t latex" + EXT=".tex" + SPLIT=true;; + "pdf") OPTS="$OPTS -t pdf" + EXT=".pdf" + SPLIT=true;; + "epub") OPTS="$OPTS -t epub" + EXT=".epub" + SPLIT=false;; + esac + if $SPLIT + then + mkdir -p build/pandoc/$FMT/$TARGET + for FNAME in $TARGET/*.rst + do + pandoc $OPTS -o build/pandoc/$FMT/${FNAME/.rst/}$EXT $FNAME + done + else + pandoc $OPTS -o build/pandoc/$FMT/$TARGET$EXT $TARGET/*.rst + fi + done +} + + +print_help() +{ + echo "Usage: pandoc_build.sh [-H] [-l] [-p] [-e]" + echo " {esempi,strumenti} [{esempi,strumenti} ...]" + echo "Options:" + echo " -H HTML5 snippet" + echo " -l latex snippet" + echo " -p PDF" + echo " -e epub" +} + +# Option parsing + +FORMATS="" + +while getopts "hHlpoe" Option +do + case $Option in + h) print_help + exit;; + H) FORMATS="$FORMATS html";; + l) FORMATS="$FORMATS latex";; + p) FORMATS="$FORMATS pdf";; + e) FORMATS="$FORMATS epub";; + esac +done +shift $(($OPTIND - 1)) + +for TARGET in $* +do + case $TARGET in + "esempi") build;; + "strumenti") build;; + *) print_help;; + esac +done |