aboutsummaryrefslogtreecommitdiff
path: root/markdown2pdf
diff options
context:
space:
mode:
authorroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-11-13 16:34:07 +0000
committerroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2006-11-13 16:34:07 +0000
commit19486ee0e17b12ed5a0c800c8cd8e43fe3522065 (patch)
tree5eaab59c602d3d0ac8abd1db09f967f1992cbf0b /markdown2pdf
parent5a66fa030d6ffd09d82b612f2b97bc737ec753a5 (diff)
downloadpandoc-19486ee0e17b12ed5a0c800c8cd8e43fe3522065.tar.gz
* Add PANDOC_OPTS support to 'markdown2pdf'.
* Sanitize comand line handling a bit in all wrappers: + Correct delimiters syntax should be ' -- '. + Print warning for extra arguments which are ignored. + Instead of positional arguments use named variables whenever appropriate. git-svn-id: https://pandoc.googlecode.com/svn/trunk@97 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'markdown2pdf')
-rw-r--r--markdown2pdf13
1 files changed, 13 insertions, 0 deletions
diff --git a/markdown2pdf b/markdown2pdf
index 59c0ba634..80b2723cf 100644
--- a/markdown2pdf
+++ b/markdown2pdf
@@ -21,6 +21,13 @@ for p in pandoc pdflatex; do
}
done
+ALL="$*"
+ARGS=${ALL%% -- *} # only the part before ' -- ' delimiters is relevant
+set -- $ARGS
+
+REST=${ALL#$ARGS}; REST=${REST#--}
+PANDOC_OPTS=${REST:-$PANDOC_OPTS}
+
outfile=
for option; do
if [ -n "$prev" ]; then
@@ -52,6 +59,12 @@ done
}
infile=$1
+shift
+
+if [ -n "$@" ]; then
+ echo >&2 "Warning: extra arguments '$@' will be ignored!"
+fi
+
if [ -z "$outfile" ]; then
if [ -n "$infile" ]; then
outfile=${infile%.*}.pdf