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.
This commit is contained in:
parent
a21c5ba7c8
commit
a9628d0745
1 changed files with 3 additions and 3 deletions
|
@ -108,8 +108,7 @@ convertImages tmpdir (Image ils (src, tit)) = do
|
|||
img <- convertImage tmpdir src
|
||||
newPath <-
|
||||
case img of
|
||||
Left e -> src <$
|
||||
warn ("Unable to convert image `" ++ src ++ "':\n" ++ e)
|
||||
Left e -> src <$ warn e
|
||||
Right fp -> return fp
|
||||
return (Image ils (newPath, tit))
|
||||
convertImages _ x = return x
|
||||
|
@ -123,7 +122,8 @@ convertImage tmpdir fname =
|
|||
Just "application/pdf" -> doNothing
|
||||
_ -> JP.readImage fname >>= \res ->
|
||||
case res of
|
||||
Left msg -> return $ Left msg
|
||||
Left msg -> return $ Left $ "Unable to convert `" ++
|
||||
fname ++ "' for use with pdflatex."
|
||||
Right img ->
|
||||
E.catch (Right fileOut <$ JP.savePngImage fileOut img) $
|
||||
\(e :: E.SomeException) -> return (Left (show e))
|
||||
|
|
Loading…
Add table
Reference in a new issue