From 900e352f1cc53c06cc3ba95cd79630572e88f5a7 Mon Sep 17 00:00:00 2001 From: roktas Date: Sun, 7 Jan 2007 03:17:40 +0000 Subject: + 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 --- src/wrappers/markdown2pdf.in | 13 ++++++++++--- 1 file 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/" -- cgit v1.2.3