@@ -42,7 +42,7 @@ DokuWiki: <https://www.dokuwiki.org/dokuwiki>
4242module Text.Pandoc.Writers.DokuWiki ( writeDokuWiki ) where
4343import Prelude
4444import Control.Monad (zipWithM)
45−import Control.Monad.Reader (ReaderT, ask, local, runReaderT)
45+import Control.Monad.Reader (ReaderT, asks, local, runReaderT)
4646import Control.Monad.State.Strict (StateT, evalStateT)
4747import Data.Default (Default (..))
4848import Data.List (intercalate, intersect, isPrefixOf, transpose)
@@ -135,8 +135,8 @@ blockToDokuWiki opts (Para [Image attr txt (src,'f':'i':'g':':':tit)]) = do
135135 return $ "{{" ++ prefix ++ src ++ imageDims opts attr ++ opt ++ "}}\n"
136136
137137blockToDokuWiki opts (Para inlines) = do
138− indent <- stIndent <$> ask
139− useTags <- stUseTags <$> ask
138+ indent <- asks stIndent
139+ useTags <- asks stUseTags
140140 contents <- inlineListToDokuWiki opts inlines
141141 return $ if useTags
142142 then "<HTML><p></HTML>" ++ contents ++ "<HTML></p></HTML>"
@@ -211,9 +211,9 @@ blockToDokuWiki opts (Table capt aligns _ headers rows) = do
211211 unlines (map (renderRow "|") rows')
212212
213213blockToDokuWiki opts x@(BulletList items) = do
214− oldUseTags <- stUseTags <$> ask
215− indent <- stIndent <$> ask
216− backSlash <- stBackSlashLB <$> ask
214+ oldUseTags <- asks stUseTags
215+ indent <- asks stIndent
216+ backSlash <- asks stBackSlashLB
217217 let useTags = oldUseTags || not (isSimpleList x)
218218 if useTags
219219 then do
@@ -227,9 +227,9 @@ blockToDokuWiki opts x@(BulletList items) = do
227227 return $ vcat contents ++ if null indent then "\n" else ""
228228
229229blockToDokuWiki opts x@(OrderedList attribs items) = do
230− oldUseTags <- stUseTags <$> ask
231− indent <- stIndent <$> ask
232− backSlash <- stBackSlashLB <$> ask
230+ oldUseTags <- asks stUseTags
231+ indent <- asks stIndent
232+ backSlash <- asks stBackSlashLB
233233 let useTags = oldUseTags || not (isSimpleList x)
234234 if useTags
235235 then do
@@ -246,9 +246,9 @@ blockToDokuWiki opts x@(OrderedList attribs items) = do
246246-- is a specific representation of them.
247247-- TODO This creates double '; ; ' if there is a bullet or ordered list inside a definition list
248248blockToDokuWiki opts x@(DefinitionList items) = do
249− oldUseTags <- stUseTags <$> ask
250− indent <- stIndent <$> ask
251− backSlash <- stBackSlashLB <$> ask
249+ oldUseTags <- asks stUseTags
250+ indent <- asks stIndent
251+ backSlash <- asks stBackSlashLB
252252 let useTags = oldUseTags || not (isSimpleList x)
253253 if useTags
254254 then do
@@ -278,7 +278,7 @@ listAttribsToString (startnum, numstyle, _) =
278278listItemToDokuWiki :: PandocMonad m
279279 => WriterOptions -> [Block] -> DokuWiki m String
280280listItemToDokuWiki opts items = do
281− useTags <- stUseTags <$> ask
281+ useTags <- asks stUseTags
282282 if useTags
283283 then do
284284 contents <- blockListToDokuWiki opts items
@@ -288,8 +288,8 @@ listItemToDokuWiki opts items = do
288288 let contents = case items of
289289 [_, CodeBlock _ _] -> concat bs
290290 _ -> vcat bs
291− indent <- stIndent <$> ask
292− backSlash <- stBackSlashLB <$> ask
291+ indent <- asks stIndent
292+ backSlash <- asks stBackSlashLB
293293 let indent' = if backSlash then drop 2 indent else indent
294294 return $ indent' ++ "* " ++ contents
295295
@@ -298,12 +298,12 @@ listItemToDokuWiki opts items = do
298298orderedListItemToDokuWiki :: PandocMonad m => WriterOptions -> [Block] -> DokuWiki m String
299299orderedListItemToDokuWiki opts items = do
300300 contents <- blockListToDokuWiki opts items
301− useTags <- stUseTags <$> ask
301+ useTags <- asks stUseTags
302302 if useTags
303303 then return $ "<HTML><li></HTML>" ++ contents ++ "<HTML></li></HTML>"
304304 else do
305− indent <- stIndent <$> ask
306− backSlash <- stBackSlashLB <$> ask
305+ indent <- asks stIndent
306+ backSlash <- asks stBackSlashLB
307307 let indent' = if backSlash then drop 2 indent else indent
308308 return $ indent' ++ "- " ++ contents
309309
@@ -315,13 +315,13 @@ definitionListItemToDokuWiki :: PandocMonad m
315315definitionListItemToDokuWiki opts (label, items) = do
316316 labelText <- inlineListToDokuWiki opts label
317317 contents <- mapM (blockListToDokuWiki opts) items
318− useTags <- stUseTags <$> ask
318+ useTags <- asks stUseTags
319319 if useTags
320320 then return $ "<HTML><dt></HTML>" ++ labelText ++ "<HTML></dt></HTML>\n" ++
321321 intercalate "\n" (map (\d -> "<HTML><dd></HTML>" ++ d ++ "<HTML></dd></HTML>") contents)
322322 else do
323− indent <- stIndent <$> ask
324− backSlash <- stBackSlashLB <$> ask
323+ indent <- asks stIndent
324+ backSlash <- asks stBackSlashLB
325325 let indent' = if backSlash then drop 2 indent else indent
326326 return $ indent' ++ "* **" ++ labelText ++ "** " ++ concat contents
327327
@@ -403,7 +403,7 @@ blockListToDokuWiki :: PandocMonad m
403403 -> [Block] -- ^ List of block elements
404404 -> DokuWiki m String
405405blockListToDokuWiki opts blocks = do
406− backSlash <- stBackSlashLB <$> ask
406+ backSlash <- asks stBackSlashLB
407407 let blocks' = consolidateRawBlocks blocks
408408 if backSlash
409409 then backSlashLineBreaks <$> mapM (blockToDokuWiki opts) blocks'
@@ -486,7 +486,7 @@ inlineToDokuWiki _ il@(RawInline f str)
486486 | otherwise = "" <$ report (InlineNotRendered il)
487487
488488inlineToDokuWiki _ LineBreak = do
489− backSlash <- stBackSlashLB <$> ask
489+ backSlash <- asks stBackSlashLB
490490 return $ if backSlash
491491 then "\n"
492492 else "\\\\\n"