aboutsummaryrefslogtreecommitdiff
path: root/latex2markdown
diff options
context:
space:
mode:
Diffstat (limited to 'latex2markdown')
-rw-r--r--latex2markdown21
1 files changed, 17 insertions, 4 deletions
diff --git a/latex2markdown b/latex2markdown
index e5e276d62..4f5efef83 100644
--- a/latex2markdown
+++ b/latex2markdown
@@ -1,11 +1,24 @@
#!/bin/sh -e
# runs pandoc to convert latex to markdown
+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
- which $p >/dev/null 2>&1 || {
- echo >&2 "You need '$p' to use this program!"
- exit 1
- }
+ pathfind $p || {
+ echo >&2 "You need '$p' to use this program!"
+ exit 1
+ }
done
iconv -t utf-8 $* | pandoc $PANDOC_OPTS -r latex -w markdown -s | iconv -f utf-8