git.iko.soy/typeable/pandoc
on master help sign in
Class: more haddocks.
commit8cbc28415ef7246e9eb5b74d8958f1ab0dc01d4d authorJohn MacFarlane <jgm@berkeley.edu> dateSat 29 Jul 2017, 21:04 (9 years ago) parent7f9e950
1 file changed+12
src/Text/Pandoc/Class.hs+12
src/Text/Pandoc/Class.hs+12
@@ -186,13 +186,21 @@ class (Functor m, Applicative m, Monad m, MonadError PandocError m)
186186
187187-- * Functions defined for all PandocMonad instances
188188
189+-- | Set the verbosity level.
189190setVerbosity :: PandocMonad m => Verbosity -> m ()
190191setVerbosity verbosity =
191192 modifyCommonState $ \st -> st{ stVerbosity = verbosity }
192193
194+-- Get the accomulated log messages (in temporal order).
193195getLog :: PandocMonad m => m [LogMessage]
194196getLog = reverse <$> getsCommonState stLog
195197
198+-- | Log a message using 'logOutput'. Note that
199+-- 'logOutput' is called only if the verbosity
200+-- level exceeds the level of the message, but
201+-- the message is added to the list of log messages
202+-- that will be retrieved by 'getLog' regardless
203+-- of its verbosity level.
196204report :: PandocMonad m => LogMessage -> m ()
197205report msg = do
198206 verbosity <- getsCommonState stVerbosity
@@ -200,9 +208,13 @@ report msg = do
200208 when (level <= verbosity) $ logOutput msg
201209 modifyCommonState $ \st -> st{ stLog = msg : stLog st }
202210
211+-- | Determine whether tracing is enabled. This affects
212+-- the behavior of 'trace'. If tracing is not enabled,
213+-- 'trace' does nothing.
203214setTrace :: PandocMonad m => Bool -> m ()
204215setTrace useTracing = modifyCommonState $ \st -> st{stTrace = useTracing}
205216
217+-- | Initialize the media bag.
206218setMediaBag :: PandocMonad m => MediaBag -> m ()
207219setMediaBag mb = modifyCommonState $ \st -> st{stMediaBag = mb}
208220