summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-11-22 10:56:59 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2016-11-22 10:56:59 +0100
commit77912ddc56650aacc47a4e6fe722e758a77b06e2 (patch)
tree15df26f34cb314acf63c96601d813bad7ee3dc54 /src/Text/Pandoc/Writers
parent77753747d111966610b9c3cdcbe75712540bc816 (diff)
Put 'warn' in MonadIO. Add warnings for math conversions in docx.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs6
-rw-r--r--src/Text/Pandoc/Writers/ICML.hs4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index b6da3dc69..6cc90f4d9 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -1115,7 +1115,9 @@ inlineToOpenXML' opts (Math mathType str) = do
when (displayType == DisplayBlock) setFirstPara
case writeOMML displayType <$> readTeX str of
Right r -> return [r]
- Left _ -> inlinesToOpenXML opts (texMathToInlines mathType str)
+ Left e -> do
+ warn $ "Cannot convert the following TeX math, skipping:\n" ++ str
+ inlinesToOpenXML opts (texMathToInlines mathType str)
inlineToOpenXML' opts (Cite _ lst) = inlinesToOpenXML opts lst
inlineToOpenXML' opts (Code attrs str) = do
let unhighlighted = intercalate [br] `fmap`
@@ -1180,7 +1182,7 @@ inlineToOpenXML' opts (Image attr alt (src, title)) = do
fetchItem' (writerMediaBag opts) (writerSourceURL opts) src
case res of
Left (_ :: E.SomeException) -> do
- liftIO $ warn $ "Could not find image `" ++ src ++ "', skipping..."
+ warn $ "Could not find image `" ++ src ++ "', skipping..."
-- emit alt text
inlinesToOpenXML opts alt
Right (img, mt) -> do
diff --git a/src/Text/Pandoc/Writers/ICML.hs b/src/Text/Pandoc/Writers/ICML.hs
index 125deb08c..09d1a9c79 100644
--- a/src/Text/Pandoc/Writers/ICML.hs
+++ b/src/Text/Pandoc/Writers/ICML.hs
@@ -534,13 +534,13 @@ imageICML opts style attr (src, _) = do
res <- liftIO $ fetchItem (writerSourceURL opts) src
imgS <- case res of
Left (_) -> do
- liftIO $ warn $ "Could not find image `" ++ src ++ "', skipping..."
+ warn $ "Could not find image `" ++ src ++ "', skipping..."
return def
Right (img, _) -> do
case imageSize img of
Right size -> return size
Left msg -> do
- return $ warn $ "Could not determine image size in `" ++
+ warn $ "Could not determine image size in `" ++
src ++ "': " ++ msg
return def
let (ow, oh) = sizeInPoints imgS