From 58697ebe785b1f7eb4713d8874cd5aaae4d6a03b Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Mon, 8 Jan 2007 19:55:34 +0000 Subject: Modified shell scripts to use new Pandoc --dump-args and --ignore-args features. This allows a simpler, cleaner design. Make use of TEXINPUTS environment variable to ensure that pdflatex will find images and other sources in the working directory from which markdown2pdf is called. git-svn-id: https://pandoc.googlecode.com/svn/trunk@456 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/wrappers/common.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/wrappers/common.sh') diff --git a/src/wrappers/common.sh b/src/wrappers/common.sh index 2cde64157..9605f5940 100644 --- a/src/wrappers/common.sh +++ b/src/wrappers/common.sh @@ -6,6 +6,11 @@ NEWLINE=' err () { echo "$*" | fold -s -w ${COLUMNS:-110} >&2; } errn () { printf "$*" | fold -s -w ${COLUMNS:-110} >&2; } +usage () { + err "$1 - $2" # short description + err "See the $1(1) man page for usage." +} + # Portable which(1). pathfind () { oldifs="$IFS"; IFS=':' @@ -25,3 +30,14 @@ for p in pandoc $REQUIRED; do exit 1 } done + +CONF=$(pandoc --dump-args "$@" 2>&1) || { + errcode=$? + echo "$CONF" | sed -e '/^pandoc \[OPTIONS\] \[FILES\]/,$d' >&2 + [ $errcode -eq 2 ] && usage "$THIS" "$SYNOPSIS" + exit $errcode +} + +OUTPUT=$(echo "$CONF" | sed -ne '1p') +ARGS=$(echo "$CONF" | sed -e '1d') + -- cgit v1.2.3