diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-01-02 18:18:59 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2010-01-02 18:18:59 +0000 |
commit | ce28d00b87aa027ae140325a33eaaff2f672cde3 (patch) | |
tree | a6762494820dd8b0632495f7959bd169375f640d /markdown2pdf | |
parent | 6aea1f92019f6e86c8e1f41c94a8d0d5a4d879d3 (diff) | |
download | pandoc-ce28d00b87aa027ae140325a33eaaff2f672cde3.tar.gz |
markdown2pdf: Fixes to usage and error reporting.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1775 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'markdown2pdf')
-rwxr-xr-x | markdown2pdf | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/markdown2pdf b/markdown2pdf index 4e85a371d..20950e022 100755 --- a/markdown2pdf +++ b/markdown2pdf @@ -18,7 +18,8 @@ errn () { printf "$*" | fold -s -w ${COLUMNS:-110} >&2; } usage () { err "$1 - $2" # short description - err "See the $1(1) man page for usage." + err "Options:" + pandoc -h | sed -ne '/--strict\|--preserve-tabs\|--tab-stop\|--parse-raw\|--toc\|--xetex\|--number-sections\|--include-in-header\|--include-before-body\|--include-after-body\|--custom-header\|--output\|--template\|--variable\|--help\|--version/p' >&2 } # Portable which(1). @@ -41,13 +42,12 @@ for p in pandoc $REQUIRED; do } 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 -} +if (echo "$@" | grep -q -- "--help\|-h"); then + usage "$THIS" "$SYNOPSIS" + exit 0 +fi +CONF=$(pandoc --dump-args "$@") || exit $? OUTPUT=$(echo "$CONF" | sed -ne '1p') ARGS=$(echo "$CONF" | sed -e '1d') @@ -111,7 +111,7 @@ fi exit $errcode } if [ $runs -lt 3 ] && - ((grep -q "LaTeX Warning: There were undefined references." $texname.log) || + ((grep -q "Warning: There were undefined references." $texname.log) || (echo "$@" | grep -q -- "--toc\|--table-of-contents")); then runs=$(($runs + 1)) if grep -q "LaTeX Warning:.*[Cc]itation" $texname.log; then |