@@ -97,6 +97,7 @@ class (Functor m, Applicative m, Monad m, MonadError PandocExecutionError m) =>
9797 -> String
9898 -> m (Either E.SomeException (B.ByteString, Maybe MimeType))
9999 warn :: String -> m ()
100+ getWarnings :: m [String]
100101 fail :: String -> m b
101102 glob :: String -> m [FilePath]
102103
@@ -113,11 +114,11 @@ data PandocExecutionError = PandocFileReadError FilePath
113114 deriving (Show, Typeable)
114115
115116-- Nothing in this for now, but let's put it there anyway.
116−data PandocStateIO = PandocStateIO
117+data PandocStateIO = PandocStateIO { ioStWarnings :: [String] }
117118 deriving Show
118119
119120instance Default PandocStateIO where
120− def = PandocStateIO
121+ def = PandocStateIO { ioStWarnings = [] }
121122
122123runIO :: PandocIO a -> IO (Either PandocExecutionError a)
123124runIO ma = flip evalStateT def $ runExceptT $ unPandocIO ma
@@ -156,7 +157,10 @@ instance PandocMonad PandocIO where
156157 fail = M.fail
157158 fetchItem ms s = liftIO $ IO.fetchItem ms s
158159 fetchItem' mb ms s = liftIO $ IO.fetchItem' mb ms s
159− warn = liftIO . IO.warn
160+ warn msg = do
161+ modify $ \st -> st{ioStWarnings = msg : ioStWarnings st}
162+ liftIO $ IO.warn msg
163+ getWarnings = gets ioStWarnings
160164 glob = liftIO . IO.glob
161165
162166data TestState = TestState { stStdGen :: StdGen
@@ -266,6 +270,8 @@ instance PandocMonad PandocPure where
266270
267271 warn s = modify $ \st -> st { stWarnings = s : stWarnings st }
268272
273+ getWarnings = gets stWarnings
274+
269275 glob s = do
270276 fontFiles <- asks envFontFiles
271277 return (filter (match (compile s)) fontFiles)