pandoc/markdown2latex
fiddlosopher 574290c92f Modified wrapper scripts to pass all command-line options after --
to pandoc.  These options override the environment variable PANDOC_OPTS,
if it is set.  (Note:  these changes don't include changes to the
documentation or man pages, or to markdown2pdf.)


git-svn-id: https://pandoc.googlecode.com/svn/trunk@95 788f1e2b-df1e-0410-8736-df70ead52e1b
2006-11-13 15:22:41 +00:00

31 lines
600 B
Bash

#!/bin/sh -e
# converts markdown to latex
pathfind () { # portable which(1), code taken from Debian Developer's Reference
OLDIFS="$IFS"
IFS=:
for _p in $PATH; do
if [ -x "$_p/$*" ]; then
IFS="$OLDIFS"
return 0
fi
done
IFS="$OLDIFS"
return 1
}
for p in pandoc; do
pathfind $p || {
echo >&2 "You need '$p' to use this program!"
exit 1
}
done
ALL="$*"
ARGS=${ALL%%-- *}
REST=${ALL#$ARGS}
REST=${REST#--}
PANDOC_OPTS=${REST:-$PANDOC_OPTS}
iconv -t utf-8 $ARGS | pandoc $PANDOC_OPTS -w latex -s | iconv -f utf-8