Created
February 25, 2011 17:46
-
-
Save alexwall/844179 to your computer and use it in GitHub Desktop.
takes template with -t option and searches in a custom templates dir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Autor: Alex Wall | |
# Licence: GPLv3 | |
# pandoc (markdown2pdf) needs an path to a template | |
# this script searches for a template in a custom folder (TEMPLATE_DIR) | |
# you can pass any other option (e.g. xetex), it will be passed to markdown2pdf | |
# the default custom pandoc template (latex.template) in ~/.pandoc/templates | |
TEMPLATE="latex.template" | |
TEMPLATE_DIR=$HOME/.pandoc/templates/ | |
while getopts 't:' OPTION ; do | |
case $OPTION in | |
t) TEMPLATE=$TEMPLATE_DIR$OPTARG.template | |
shift $((OPTIND-1));; | |
\?) # do nothing | |
;; | |
:) echo "Option \"-$OPTARG\" needs an argument" | |
echo $HELP ; exit 1;; | |
esac | |
done | |
# run markdown2pdf with options | |
markdown2pdf --template=$TEMPLATE $@ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment