@@ -18,7 +18,8 @@ errn () { printf "$*" | fold -s -w ${COLUMNS:-110} >&2; }
1818
1919usage () {
2020 err "$1 - $2" # short description
21− err "See the $1(1) man page for usage."
21+ err "Options:"
22+ 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
2223}
2324
2425# Portable which(1).
@@ -41,13 +42,12 @@ for p in pandoc $REQUIRED; do
4142 }
4243done
4344
44−CONF=$(pandoc --dump-args "$@" 2>&1) || {
45− errcode=$?
46− echo "$CONF" | sed -e '/^pandoc \[OPTIONS\] \[FILES\]/,$d' >&2
47− [ $errcode -eq 2 ] && usage "$THIS" "$SYNOPSIS"
48− exit $errcode
49−}
45+if (echo "$@" | grep -q -- "--help\|-h"); then
46+ usage "$THIS" "$SYNOPSIS"
47+ exit 0
48+fi
5049
50+CONF=$(pandoc --dump-args "$@") || exit $?
5151OUTPUT=$(echo "$CONF" | sed -ne '1p')
5252ARGS=$(echo "$CONF" | sed -e '1d')
5353
@@ -111,7 +111,7 @@ fi
111111 exit $errcode
112112 }
113113 if [ $runs -lt 3 ] &&
114− ((grep -q "LaTeX Warning: There were undefined references." $texname.log) ||
114+ ((grep -q "Warning: There were undefined references." $texname.log) ||
115115 (echo "$@" | grep -q -- "--toc\|--table-of-contents")); then
116116 runs=$(($runs + 1))
117117 if grep -q "LaTeX Warning:.*[Cc]itation" $texname.log; then