aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2018-10-29 22:33:11 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2018-10-29 22:33:11 -0700
commit4fe28e947a38bffdbb4eeccb16e62dc1824b9c74 (patch)
tree31ea4c059826be29e102a23c694ff575034b086d /src/Text
parentc51be5dfc85024e68a4bd62c9ced748b27f968c0 (diff)
downloadpandoc-4fe28e947a38bffdbb4eeccb16e62dc1824b9c74.tar.gz
ZimWiki writer: remove extra indentation on lists.
Closes #4963.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/ZimWiki.hs16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Writers/ZimWiki.hs b/src/Text/Pandoc/Writers/ZimWiki.hs
index a583b07b1..40efaa8cf 100644
--- a/src/Text/Pandoc/Writers/ZimWiki.hs
+++ b/src/Text/Pandoc/Writers/ZimWiki.hs
@@ -183,17 +183,13 @@ blockToZimWiki opts (Table capt aligns _ headers rows) = do
unlines (map renderRow rows')
blockToZimWiki opts (BulletList items) = do
- indent <- gets stIndent
- modify $ \s -> s { stIndent = stIndent s ++ "\t" }
contents <- mapM (listItemToZimWiki opts) items
- modify $ \s -> s{ stIndent = indent } -- drop 1 (stIndent s) }
+ indent <- gets stIndent
return $ vcat contents ++ if null indent then "\n" else ""
blockToZimWiki opts (OrderedList _ items) = do
- indent <- gets stIndent
- modify $ \s -> s { stIndent = stIndent s ++ "\t", stItemNum = 1 }
contents <- mapM (orderedListItemToZimWiki opts) items
- modify $ \s -> s{ stIndent = indent } -- drop 1 (stIndent s) }
+ indent <- gets stIndent
return $ vcat contents ++ if null indent then "\n" else ""
blockToZimWiki opts (DefinitionList items) = do
@@ -246,16 +242,20 @@ vcat = intercalate "\n"
-- | Convert bullet list item (list of blocks) to ZimWiki.
listItemToZimWiki :: PandocMonad m => WriterOptions -> [Block] -> ZW m String
listItemToZimWiki opts items = do
- contents <- blockListToZimWiki opts items
indent <- gets stIndent
+ modify $ \s -> s { stIndent = indent ++ "\t" }
+ contents <- blockListToZimWiki opts items
+ modify $ \s -> s{ stIndent = indent }
return $ indent ++ "* " ++ contents
-- | Convert ordered list item (list of blocks) to ZimWiki.
orderedListItemToZimWiki :: PandocMonad m
=> WriterOptions -> [Block] -> ZW m String
orderedListItemToZimWiki opts items = do
- contents <- blockListToZimWiki opts items
indent <- gets stIndent
+ modify $ \s -> s { stIndent = indent ++ "\t" }
+ contents <- blockListToZimWiki opts items
+ modify $ \s -> s{ stIndent = indent }
itemnum <- gets stItemNum
--modify $ \s -> s { stItemNum = itemnum + 1 } -- this is not strictly necessary for zim as zim does its own renumbering
return $ indent ++ show itemnum ++ ". " ++ contents