aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-12-03 18:42:17 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-01-25 17:07:40 +0100
commita4bd650277ac8fd2c952f2330e4d23a200d691a5 (patch)
tree9d6d202862b4f460669223dc0abd0e21b11ec7b4 /src/Text/Pandoc/Writers
parent63dc6bd02509eb31d9d221c4e39f18af2b77fe6d (diff)
downloadpandoc-a4bd650277ac8fd2c952f2330e4d23a200d691a5.tar.gz
Class: rename addWarning[WithPos] to warning[WithPos].
There's already a function addWarning in Parsing! Maybe we can dispense with that now, but I still like 'warning' better as a name.
Diffstat (limited to 'src/Text/Pandoc/Writers')
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs2
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs4
-rw-r--r--src/Text/Pandoc/Writers/ICML.hs4
-rw-r--r--src/Text/Pandoc/Writers/Math.hs4
-rw-r--r--src/Text/Pandoc/Writers/ODT.hs4
-rw-r--r--src/Text/Pandoc/Writers/RTF.hs12
6 files changed, 15 insertions, 15 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 3b1df6bd9..0f040d19b 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -1182,7 +1182,7 @@ inlineToOpenXML' opts (Image attr alt (src, title)) = do
res <- (lift . lift) $ P.fetchItem' (writerMediaBag opts) (writerSourceURL opts) src
case res of
Left (_ :: E.SomeException) -> do
- (lift . lift) $ P.addWarning ("Could not find image `" ++ src ++ "', skipping...")
+ (lift . lift) $ P.warning ("Could not find image `" ++ src ++ "', skipping...")
-- emit alt text
inlinesToOpenXML opts alt
Right (img, mt) -> do
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index b1266c4c9..1c3a44207 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -398,7 +398,7 @@ pandocToEPUB opts doc@(Pandoc meta _) = do
let matchingGlob f = do
xs <- lift $ P.glob f
when (null xs) $
- lift $ P.addWarning $ f ++ " did not match any font files."
+ lift $ P.warning $ f ++ " did not match any font files."
return xs
let mkFontEntry f = mkEntry (takeFileName f) `fmap` (lift $ P.readFileLazy f)
fontFiles <- concat <$> mapM matchingGlob (writerEpubFonts opts')
@@ -864,7 +864,7 @@ modifyMediaRef opts oldsrc = do
(new, mbEntry) <-
case res of
Left _ -> do
- lift $ P.addWarning $ "Could not find media `" ++ oldsrc ++ "', skipping..."
+ lift $ P.warning $ "Could not find media `" ++ oldsrc ++ "', skipping..."
return (oldsrc, Nothing)
Right (img,mbMime) -> do
let new = "media/file" ++ show (length media) ++
diff --git a/src/Text/Pandoc/Writers/ICML.hs b/src/Text/Pandoc/Writers/ICML.hs
index 482e20f4b..6bc7436d8 100644
--- a/src/Text/Pandoc/Writers/ICML.hs
+++ b/src/Text/Pandoc/Writers/ICML.hs
@@ -537,13 +537,13 @@ imageICML opts style attr (src, _) = do
res <- lift $ P.fetchItem (writerSourceURL opts) src
imgS <- case res of
Left (_) -> do
- lift $ P.addWarning $ "Could not find image `" ++ src ++ "', skipping..."
+ lift $ P.warning $ "Could not find image `" ++ src ++ "', skipping..."
return def
Right (img, _) -> do
case imageSize img of
Right size -> return size
Left msg -> do
- lift $ P.addWarning $ "Could not determine image size in `" ++
+ lift $ P.warning $ "Could not determine image size in `" ++
src ++ "': " ++ msg
return def
let (ow, oh) = sizeInPoints imgS
diff --git a/src/Text/Pandoc/Writers/Math.hs b/src/Text/Pandoc/Writers/Math.hs
index 552db8b32..b959ce972 100644
--- a/src/Text/Pandoc/Writers/Math.hs
+++ b/src/Text/Pandoc/Writers/Math.hs
@@ -20,7 +20,7 @@ texMathToInlines mt inp = do
case res of
Right (Just ils) -> return ils
Right (Nothing) -> do
- addWarning $ "Could not render TeX math as unicode, rendering as raw TeX:\n" ++ inp
+ warning $ "Could not render TeX math as unicode, rendering as raw TeX:\n" ++ inp
return [mkFallback mt inp]
Left il -> return [il]
@@ -40,7 +40,7 @@ convertMath writer mt str = do
case writer dt <$> readTeX str of
Right r -> return (Right r)
Left e -> do
- addWarning $ "Could not convert TeX math, rendering as raw TeX:\n" ++
+ warning $ "Could not convert TeX math, rendering as raw TeX:\n" ++
str ++ "\n" ++ e
return (Left $ mkFallback mt str)
where dt = case mt of
diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs
index db9090e29..b17b18a21 100644
--- a/src/Text/Pandoc/Writers/ODT.hs
+++ b/src/Text/Pandoc/Writers/ODT.hs
@@ -147,13 +147,13 @@ transformPicMath opts (Image attr@(id', cls, _) lab (src,t)) = do
res <- lift $ P.fetchItem' (writerMediaBag opts) (writerSourceURL opts) src
case res of
Left (_ :: E.SomeException) -> do
- lift $ P.addWarning $ "Could not find image `" ++ src ++ "', skipping..."
+ lift $ P.warning $ "Could not find image `" ++ src ++ "', skipping..."
return $ Emph lab
Right (img, mbMimeType) -> do
(ptX, ptY) <- case imageSize img of
Right s -> return $ sizeInPoints s
Left msg -> do
- lift $ P.addWarning $ "Could not determine image size in `" ++
+ lift $ P.warning $ "Could not determine image size in `" ++
src ++ "': " ++ msg
return (100, 100)
let dims =
diff --git a/src/Text/Pandoc/Writers/RTF.hs b/src/Text/Pandoc/Writers/RTF.hs
index 32f70cb31..a3351a705 100644
--- a/src/Text/Pandoc/Writers/RTF.hs
+++ b/src/Text/Pandoc/Writers/RTF.hs
@@ -36,7 +36,7 @@ import Text.Pandoc.Writers.Shared
import Text.Pandoc.Writers.Math
import Text.Pandoc.Templates (renderTemplate')
import Text.Pandoc.Walk
-import Text.Pandoc.Class (addWarning)
+import Text.Pandoc.Class (warning)
import Data.List ( isSuffixOf, intercalate )
import Data.Char ( ord, chr, isDigit )
import qualified Data.ByteString as B
@@ -64,7 +64,7 @@ rtfEmbedImage opts x@(Image attr _ (src,_)) = do
_ -> throwError $ PandocSomeError "Unknown file type"
sizeSpec <- case imageSize imgdata of
Left msg -> do
- addWarning $ "Could not determine image size in `" ++
+ warning $ "Could not determine image size in `" ++
src ++ "': " ++ msg
return ""
Right sz -> return $ "\\picw" ++ show xpx ++
@@ -78,17 +78,17 @@ rtfEmbedImage opts x@(Image attr _ (src,_)) = do
concat bytes ++ "}"
if B.null imgdata
then do
- addWarning $ "Image " ++ src ++ " contained no data, skipping."
+ warning $ "Image " ++ src ++ " contained no data, skipping."
return x
else return $ RawInline (Format "rtf") raw
| otherwise -> do
- addWarning $ "Image " ++ src ++ " is not a jpeg or png, skipping."
+ warning $ "Image " ++ src ++ " is not a jpeg or png, skipping."
return x
Right (_, Nothing) -> do
- addWarning $ "Could not determine image type for " ++ src ++ ", skipping."
+ warning $ "Could not determine image type for " ++ src ++ ", skipping."
return x
Left e -> do
- addWarning $ "Could not fetch image " ++ src ++ "\n" ++ show e
+ warning $ "Could not fetch image " ++ src ++ "\n" ++ show e
return x
rtfEmbedImage _ x = return x