aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-08 21:50:58 +0000
committerroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-08 21:50:58 +0000
commit8b98ef22da5857cb03b7418e2071aa7d37c35f04 (patch)
treeb1ad61d0590ea77280f5c559d07341271e284950 /src
parent965f80a6cf171abe65072cc064bde2c670d4dde8 (diff)
downloadpandoc-8b98ef22da5857cb03b7418e2071aa7d37c35f04.tar.gz
Various fixes in markdown2pdf.
+ Add a trailing ':' to TEXTINPUTS as per the instruction in TeX FAQ: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=graphicspath In the lack of it, pdflatex silently fails, for example, with the following command: 'TEXINPUTS=/tmp markdown2pdf' + Put the origdir at the front for the correct directory search order. + pdflatex didn't create log file on one occasion (the above command) that made sed commands failed. Test the existence of log before filtering it. + A few non-essential changes. git-svn-id: https://pandoc.googlecode.com/svn/trunk@459 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src')
-rw-r--r--src/wrappers/markdown2pdf.in37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/wrappers/markdown2pdf.in b/src/wrappers/markdown2pdf.in
index aaae07184..51e5507f2 100644
--- a/src/wrappers/markdown2pdf.in
+++ b/src/wrappers/markdown2pdf.in
@@ -9,7 +9,6 @@ SYNOPSIS="converts markdown-formatted text to PDF, using pdflatex."
texname=output
logfile=$THIS_TEMPDIR/log
-origdir=$(pwd)
pandoc -s -r markdown -w latex "$@" -o - >$THIS_TEMPDIR/$texname.tex \
2>$logfile
@@ -23,23 +22,27 @@ else
fi
(
+ origdir=$(pwd)
cd $THIS_TEMPDIR
- TEXINPUTS=$TEXINPUTS:$origdir pdflatex -interaction=batchmode \
- $texname.tex >/dev/null 2>&1 || {
- errorcode=$?
- err "${THIS}: pdfLaTeX error context:"
- sed -ne '/^!/,/^[[:space:]]*$/p' \
- -ne '/^[Ll]a[Tt]e[Xx] [Ww]arning/,/^[[:space:]]*$/p' \
- -ne '/^[Ee]rror/,/^[[:space:]]*$/p' $texname.log >&2
- if grep -q "File \`ucs.sty' not found" $texname.log; then
- err "${THIS}: Please install the 'unicode' package from CTAN:"
- err " http://www.ctan.org/tex-archive/macros/latex/contrib/unicode/"
- fi
- if grep -q "File \`fancyvrb.sty' not found" $texname.log; then
- err "${THIS}: Please install the 'fancyvrb' package from CTAN:"
- err " http://www.ctan.org/tex-archive/macros/latex/contrib/fancyvrb/"
- fi
- exit $errorcode
+ TEXINPUTS=$origdir:$TEXINPUTS:
+ pdflatex -interaction=batchmode $texname.tex >/dev/null || {
+ errcode=$?
+ err "${THIS}: pdfLaTeX failed with error code $errcode"
+ [ -f $texname.log ] && {
+ err "${THIS}: error context:"
+ sed -ne '/^!/,/^[[:space:]]*$/p' \
+ -ne '/^[Ll]a[Tt]e[Xx] [Ww]arning/,/^[[:space:]]*$/p' \
+ -ne '/^[Ee]rror/,/^[[:space:]]*$/p' $texname.log >&2
+ if grep -q "File \`ucs.sty' not found" $texname.log; then
+ err "${THIS}: Please install the 'unicode' package from CTAN:"
+ err " http://www.ctan.org/tex-archive/macros/latex/contrib/unicode/"
+ fi
+ if grep -q "File \`fancyvrb.sty' not found" $texname.log; then
+ err "${THIS}: Please install the 'fancyvrb' package from CTAN:"
+ err " http://www.ctan.org/tex-archive/macros/latex/contrib/fancyvrb/"
+ fi
+ }
+ exit $errcode
}
) || exit $?