diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2017-03-24 10:10:56 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-03-24 10:10:56 +0200 |
commit | 519557ffe8d6c88d1cb6fdb9120b06185042cd99 (patch) | |
tree | 0e820cceb4f24fe6cf9f55e7647d5d923c32d35d /doc/cli.sh | |
parent | 603657a166bff4a16606a2575364446171466af6 (diff) |
Setup docs infra
Diffstat (limited to 'doc/cli.sh')
-rwxr-xr-x | doc/cli.sh | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/doc/cli.sh b/doc/cli.sh new file mode 100755 index 0000000..a658c3b --- /dev/null +++ b/doc/cli.sh @@ -0,0 +1,49 @@ +#! /usr/bin/env bash + +version="0.5.0" +date="January 2017" + +trap 'exit 1' ERR +set -o errtrace # Trap in functions. + +function info () { echo "$*" 1>&2; } +function error () { info "$*"; exit 1; } + +while [ $# -gt 0 ]; do + case $1 in + --clean) + rm -f build2-buildos-manual.xhtml + rm -f *.ps *.pdf + exit 0 + ;; + *) + error "unexpected $1" + ;; + esac +done + +# Manuals. +# + +function compile_doc () # <file> <prefix> <suffix> +{ + cli -I .. \ +-v version="$(echo "$version" | sed -e 's/^\([^.]*\.[^.]*\).*/\1/')" \ +-v date="$date" \ +--generate-html --html-suffix .xhtml \ +--html-prologue-file doc-prologue.xhtml \ +--html-epilogue-file doc-epilogue.xhtml \ +--output-prefix "$2" \ +--output-suffix "$3" \ +"$1" + + local n="$2$(basename -s .cli $1)$3" + + html2ps -f doc.html2ps:a4.html2ps -o "$n-a4.ps" "$n.xhtml" + ps2pdf14 -sPAPERSIZE=a4 -dOptimize=true -dEmbedAllFonts=true "$n-a4.ps" "$n-a4.pdf" + + html2ps -f doc.html2ps:letter.html2ps -o "$n-letter.ps" "$n.xhtml" + ps2pdf14 -sPAPERSIZE=letter -dOptimize=true -dEmbedAllFonts=true "$n-letter.ps" "$n-letter.pdf" +} + +compile_doc manual.cli 'build2-buildos-' |