git.iko.soy/typeable/pandoc
on master help sign in
Text.Pandoc.PDF: more comprehensible errors on image conversion.

Closes #2067. EPS can't be supported without shelling out to something like ImageMagick, but at least we can avoid mysterious error messages. We now get: pandoc: Unable to convert `circle.eps' for use with pdflatex. ! Package pdftex.def Error: File `circle-eps-converted-to.pdf' not found. which seems more straightforward.

commita9628d0745784f6f99edfca008d64dcffeb74bc8 authorJohn MacFarlane <jgm@berkeley.edu> dateSun 12 Apr 2015, 21:18 (12 years ago) parenta21c5ba
1 file changed+3−3
src/Text/Pandoc/PDF.hs+3−3
src/Text/Pandoc/PDF.hs+3−3
@@ -108,8 +108,7 @@ convertImages tmpdir (Image ils (src, tit)) = do
108108 img <- convertImage tmpdir src
109109 newPath <-
110110 case img of
111− Left e -> src <$
112− warn ("Unable to convert image `" ++ src ++ "':\n" ++ e)
111+ Left e -> src <$ warn e
113112 Right fp -> return fp
114113 return (Image ils (newPath, tit))
115114convertImages _ x = return x
@@ -123,7 +122,8 @@ convertImage tmpdir fname =
123122 Just "application/pdf" -> doNothing
124123 _ -> JP.readImage fname >>= \res ->
125124 case res of
126− Left msg -> return $ Left msg
125+ Left msg -> return $ Left $ "Unable to convert `" ++
126+ fname ++ "' for use with pdflatex."
127127 Right img ->
128128 E.catch (Right fileOut <$ JP.savePngImage fileOut img) $
129129 \(e :: E.SomeException) -> return (Left (show e))