summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/ODT.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-05-09 21:32:31 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-05-09 21:32:31 -0700
commit6fe243abbdd3394c8c5fa50db107e4dcc87c6a63 (patch)
treeb343c4b18c5630a83b5a493a1c200582427e2763 /src/Text/Pandoc/Writers/ODT.hs
parent7920a1a46987c8d57e12ffc134a9da9a9a4e9ecb (diff)
ImageSize: make imageSize return an Either, not a Maybe.
This will give us better error reporting options. This is part of a fix for #1834.
Diffstat (limited to 'src/Text/Pandoc/Writers/ODT.hs')
-rw-r--r--src/Text/Pandoc/Writers/ODT.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs
index 96928c4f6..33d9ec9d2 100644
--- a/src/Text/Pandoc/Writers/ODT.hs
+++ b/src/Text/Pandoc/Writers/ODT.hs
@@ -134,8 +134,10 @@ transformPicMath opts entriesRef (Image lab (src,t)) = do
warn $ "Could not find image `" ++ src ++ "', skipping..."
return $ Emph lab
Right (img, mbMimeType) -> do
- let size = imageSize img
- let (w,h) = fromMaybe (0,0) $ sizeInPoints `fmap` size
+ (w,h) <- case imageSize img of
+ Right size -> return $ sizeInPoints size
+ Left msg -> do warn msg
+ return (0,0)
let tit' = show w ++ "x" ++ show h
entries <- readIORef entriesRef
let extension = fromMaybe (takeExtension $ takeWhile (/='?') src)