git.iko.soy/typeable/pandoc
on master help sign in
Various fixes in markdown2pdf.
8b98ef2roktas
src/wrappers/markdown2pdf.in+20−17
@@ -9,7 +9,6 @@ SYNOPSIS="converts markdown-formatted text to PDF, using pdflatex."
9
9
10texname=output
10texname=output
11logfile=$THIS_TEMPDIR/log
11logfile=$THIS_TEMPDIR/log
12−origdir=$(pwd)
13
12
14pandoc -s -r markdown -w latex "$@" -o - >$THIS_TEMPDIR/$texname.tex \
13pandoc -s -r markdown -w latex "$@" -o - >$THIS_TEMPDIR/$texname.tex \
152>$logfile
142>$logfile
@@ -23,23 +22,27 @@ else
23fi
22fi
24
23
25(
24(
25+ origdir=$(pwd)
26 cd $THIS_TEMPDIR
26 cd $THIS_TEMPDIR
27+ TEXINPUTS=$origdir:$TEXINPUTS:
27− TEXINPUTS=$TEXINPUTS:$origdir pdflatex -interaction=batchmode \
28+ pdflatex -interaction=batchmode $texname.tex >/dev/null || {
28− $texname.tex >/dev/null 2>&1 || {
29+ errcode=$?
29− errorcode=$?
30+ err "${THIS}: pdfLaTeX failed with error code $errcode"
31+ [ -f $texname.log ] && {
30− err "${THIS}: pdfLaTeX error context:"
32+ err "${THIS}: error context:"
31− sed -ne '/^!/,/^[[:space:]]*$/p' \
33+ sed -ne '/^!/,/^[[:space:]]*$/p' \
32− -ne '/^[Ll]a[Tt]e[Xx] [Ww]arning/,/^[[:space:]]*$/p' \
34+ -ne '/^[Ll]a[Tt]e[Xx] [Ww]arning/,/^[[:space:]]*$/p' \
33− -ne '/^[Ee]rror/,/^[[:space:]]*$/p' $texname.log >&2
35+ -ne '/^[Ee]rror/,/^[[:space:]]*$/p' $texname.log >&2
34− if grep -q "File \`ucs.sty' not found" $texname.log; then
36+ if grep -q "File \`ucs.sty' not found" $texname.log; then
35− err "${THIS}: Please install the 'unicode' package from CTAN:"
37+ err "${THIS}: Please install the 'unicode' package from CTAN:"
36− err " http://www.ctan.org/tex-archive/macros/latex/contrib/unicode/"
38+ err " http://www.ctan.org/tex-archive/macros/latex/contrib/unicode/"
37− fi
39+ fi
38− if grep -q "File \`fancyvrb.sty' not found" $texname.log; then
40+ if grep -q "File \`fancyvrb.sty' not found" $texname.log; then
39− err "${THIS}: Please install the 'fancyvrb' package from CTAN:"
41+ err "${THIS}: Please install the 'fancyvrb' package from CTAN:"
40− err " http://www.ctan.org/tex-archive/macros/latex/contrib/fancyvrb/"
42+ err " http://www.ctan.org/tex-archive/macros/latex/contrib/fancyvrb/"
41− fi
43+ fi
42− exit $errorcode
44+ }
45+ exit $errcode
43 }
46 }
44) || exit $?
47) || exit $?
45
48