From 0bda602fcbae13b2eb9ee23d2abd0bcec9e548b4 Mon Sep 17 00:00:00 2001
From: Matej Kollar <208115@mail.muni.cz>
Date: Fri, 4 Jul 2014 23:48:58 +0200
Subject: Little restructuralization.
---
src/Text/Pandoc/Writers/MediaWiki.hs | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
(limited to 'src/Text/Pandoc/Writers')
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs
index 77ae27681..baf3ce240 100644
--- a/src/Text/Pandoc/Writers/MediaWiki.hs
+++ b/src/Text/Pandoc/Writers/MediaWiki.hs
@@ -162,38 +162,35 @@ blockToMediaWiki (Table capt aligns widths headers rows') = do
return $ "{|\n" ++ caption ++ tableBody ++ "|}\n"
blockToMediaWiki x@(BulletList items) = do
- oldUseTags <- asks stUseTags
- listLevel <- asks stListLevel
- let useTags = oldUseTags || not (isSimpleList x)
+ useTags <- fmap (|| not (isSimpleList x)) $ asks stUseTags
if useTags
then do
contents <- local (\ s -> s { stUseTags = True }) $ mapM listItemToMediaWiki items
return $ "
\n" ++ vcat contents ++ "
\n"
else do
+ listLevel <- asks stListLevel
contents <- local (\s -> s { stListLevel = stListLevel s ++ "*" }) $ mapM listItemToMediaWiki items
return $ vcat contents ++ if null listLevel then "\n" else ""
blockToMediaWiki x@(OrderedList attribs items) = do
- oldUseTags <- asks stUseTags
- listLevel <- asks stListLevel
- let useTags = oldUseTags || not (isSimpleList x)
+ useTags <- fmap (|| not (isSimpleList x)) $ asks stUseTags
if useTags
then do
contents <- local (\s -> s { stUseTags = True }) $ mapM listItemToMediaWiki items
return $ "\n" ++ vcat contents ++ "
\n"
else do
+ listLevel <- asks stListLevel
contents <- local (\s -> s { stListLevel = stListLevel s ++ "#" }) $ mapM listItemToMediaWiki items
return $ vcat contents ++ if null listLevel then "\n" else ""
blockToMediaWiki x@(DefinitionList items) = do
- oldUseTags <- asks stUseTags
- listLevel <- asks stListLevel
- let useTags = oldUseTags || not (isSimpleList x)
+ useTags <- fmap (|| not (isSimpleList x)) $ asks stUseTags
if useTags
then do
contents <- local (\s -> s { stUseTags = True }) $ mapM definitionListItemToMediaWiki items
return $ "\n" ++ vcat contents ++ "
\n"
else do
+ listLevel <- asks stListLevel
contents <- local (\s -> s { stListLevel = stListLevel s ++ ";" }) $ mapM definitionListItemToMediaWiki items
return $ vcat contents ++ if null listLevel then "\n" else ""
--
cgit v1.2.3