aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2015-05-09 23:56:18 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2015-05-09 23:56:53 -0700
commit60bf4a8bfb543fcf8021356e6c4ad2b994acd8c8 (patch)
tree3ffeeb09923cf8019266e429bab3f5281945e55c
parent31b3f2ef8861a8af6c146a8c6f770c6165311fc2 (diff)
downloadpandoc-60bf4a8bfb543fcf8021356e6c4ad2b994acd8c8.tar.gz
Improved warnings when image size can't be determined.
Closes #1834.
m---------data/templates14
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs7
-rw-r--r--src/Text/Pandoc/Writers/ODT.hs6
-rw-r--r--src/Text/Pandoc/Writers/RTF.hs5
4 files changed, 20 insertions, 12 deletions
diff --git a/data/templates b/data/templates
-Subproject 1b789219e50db1ac52d6fe6e471641a880cd7a3
+Subproject 1d55d847308dd681c80312e0d9549d5c765bf4c
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index cacf5102f..475f4e2ac 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -1122,8 +1122,11 @@ inlineToOpenXML opts (Image alt (src, tit)) = do
ident <- ("rId"++) `fmap` getUniqueId
(xpt,ypt) <- case imageSize img of
Right size -> return $ sizeInPoints size
- Left msg -> do liftIO (warn msg)
- return (120,120)
+ Left msg -> do
+ liftIO $ warn $
+ "Could not determine image size in `" ++
+ src ++ "': " ++ msg
+ return (120,120)
-- 12700 emu = 1 pt
let (xemu,yemu) = fitToPage (xpt * 12700, ypt * 12700) (pageWidth * 12700)
let cNvPicPr = mknode "pic:cNvPicPr" [] $
diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs
index 33d9ec9d2..e7c1cf32e 100644
--- a/src/Text/Pandoc/Writers/ODT.hs
+++ b/src/Text/Pandoc/Writers/ODT.hs
@@ -136,8 +136,10 @@ transformPicMath opts entriesRef (Image lab (src,t)) = do
Right (img, mbMimeType) -> do
(w,h) <- case imageSize img of
Right size -> return $ sizeInPoints size
- Left msg -> do warn msg
- return (0,0)
+ Left msg -> do
+ warn $ "Could not determine image size in `" ++
+ src ++ "': " ++ msg
+ return (0,0)
let tit' = show w ++ "x" ++ show h
entries <- readIORef entriesRef
let extension = fromMaybe (takeExtension $ takeWhile (/='?') src)
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs
index 588506f34..9eb02ad02 100644
--- a/src/Text/Pandoc/Writers/RTF.hs
+++ b/src/Text/Pandoc/Writers/RTF.hs
@@ -57,7 +57,10 @@ rtfEmbedImage opts x@(Image _ (src,_)) = do
"image/png" -> "\\pngblip"
_ -> error "Unknown file type"
sizeSpec <- case imageSize imgdata of
- Left msg -> warn msg >> return ""
+ Left msg -> do
+ warn $ "Could not determine image size in `" ++
+ src ++ "': " ++ msg
+ return ""
Right sz -> return $ "\\picw" ++ show xpx ++
"\\pich" ++ show ypx ++
"\\picwgoal" ++ show (xpt * 20)