pandoc/markdown2latex
roktas 2763382dd8 Replace which(1) in all wrappers with 'pathfind', a POSIX-compliant shell
function.  Expand tabs to four spaces.


git-svn-id: https://pandoc.googlecode.com/svn/trunk@94 788f1e2b-df1e-0410-8736-df70ead52e1b
2006-11-12 21:17:06 +00:00

24 lines
500 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
iconv -t utf-8 $* | pandoc $PANDOC_OPTS -w latex -s | iconv -f utf-8