aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-07 03:17:40 +0000
committerroktas <roktas@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-07 03:17:40 +0000
commit900e352f1cc53c06cc3ba95cd79630572e88f5a7 (patch)
tree62ba0822a7f4f75053c1a35e5ed3ac1391a281b5
parent6f76111e925bf918d6b444f358f421e368ca05b9 (diff)
downloadpandoc-900e352f1cc53c06cc3ba95cd79630572e88f5a7.tar.gz
+ Fix a nasty bug in markdown2pdf. It used to send the log file to
/dev/null! + Another problem is the sed filter which returns nothing with pdfeTeX '3.141592-1.21a-2.2 (Web2C 7.5.4)' here. As the first cut towards fixing, use a somewhat heuristic approach: try to build a short log by matching against a magic error stamp, dump the whole log if the previous attempt failed. Note that, there is still room to improve this code. git-svn-id: https://pandoc.googlecode.com/svn/trunk@450 788f1e2b-df1e-0410-8736-df70ead52e1b
-rw-r--r--src/wrappers/markdown2pdf.in13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/wrappers/markdown2pdf.in b/src/wrappers/markdown2pdf.in
index 71d58a7cd..1189c69ff 100644
--- a/src/wrappers/markdown2pdf.in
+++ b/src/wrappers/markdown2pdf.in
@@ -27,9 +27,16 @@ destname="${outfile:-$defaultdest}"
(
cd $THIS_TEMPDIR
- if ! pdflatex -interaction=batchmode $texname.tex >/dev/null 2>&1; then
- err "LaTeX errors:"
- sed -ne '/^!/,/^ *$/p' $texname.log >&2
+ if ! pdflatex -interaction=batchmode $texname.tex >$texname.log 2>&1; then
+ shortlog="$(sed -ne 's/^[Ee]rror:*[[:space:]]*//p' $texname.log)"
+ if [ -n "$shortlog" ]; then
+ err "Errors:"
+ err "$shortlog"
+ else
+ # Short log is not available, dump the whole log.
+ err "pdfLaTeX log:"
+ cat $texname.log >&2
+ fi
if grep -q "File \`ucs.sty' not found" $texname.log; then
err "Please install the 'unicode' package from CTAN:"
err "http://www.ctan.org/tex-archive/macros/latex/contrib/unicode/"