diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-06-27 14:46:46 -0700 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-06-27 14:46:46 -0700 |
commit | d320c2eac5d44392597f1d769568c7fae426e4b4 (patch) | |
tree | cfb21bfd8b9b1cbcb97a5840944e52dcc684c201 /src | |
parent | e9f6366af756822b61aea63aa5733df61f421e10 (diff) | |
download | pandoc-d320c2eac5d44392597f1d769568c7fae426e4b4.tar.gz |
MediaWiki writer: Avoid extra blank lines after sublists.
Thanks to Gavin Beatty.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/MediaWiki.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/MediaWiki.hs b/src/Text/Pandoc/Writers/MediaWiki.hs index f31a2c2d1..b32c5327d 100644 --- a/src/Text/Pandoc/Writers/MediaWiki.hs +++ b/src/Text/Pandoc/Writers/MediaWiki.hs @@ -149,6 +149,7 @@ blockToMediaWiki opts (Table capt aligns widths headers rows') = do blockToMediaWiki opts x@(BulletList items) = do oldUseTags <- get >>= return . stUseTags + listLevel <- get >>= return . stListLevel let useTags = oldUseTags || not (isSimpleList x) if useTags then do @@ -160,10 +161,11 @@ blockToMediaWiki opts x@(BulletList items) = do modify $ \s -> s { stListLevel = stListLevel s ++ "*" } contents <- mapM (listItemToMediaWiki opts) items modify $ \s -> s { stListLevel = init (stListLevel s) } - return $ vcat contents ++ "\n" + return $ vcat contents ++ if null listLevel then "\n" else "" blockToMediaWiki opts x@(OrderedList attribs items) = do oldUseTags <- get >>= return . stUseTags + listLevel <- get >>= return . stListLevel let useTags = oldUseTags || not (isSimpleList x) if useTags then do @@ -175,10 +177,11 @@ blockToMediaWiki opts x@(OrderedList attribs items) = do modify $ \s -> s { stListLevel = stListLevel s ++ "#" } contents <- mapM (listItemToMediaWiki opts) items modify $ \s -> s { stListLevel = init (stListLevel s) } - return $ vcat contents ++ "\n" + return $ vcat contents ++ if null listLevel then "\n" else "" blockToMediaWiki opts x@(DefinitionList items) = do oldUseTags <- get >>= return . stUseTags + listLevel <- get >>= return . stListLevel let useTags = oldUseTags || not (isSimpleList x) if useTags then do @@ -190,7 +193,7 @@ blockToMediaWiki opts x@(DefinitionList items) = do modify $ \s -> s { stListLevel = stListLevel s ++ ";" } contents <- mapM (definitionListItemToMediaWiki opts) items modify $ \s -> s { stListLevel = init (stListLevel s) } - return $ vcat contents ++ "\n" + return $ vcat contents ++ if null listLevel then "\n" else "" -- Auxiliary functions for lists: |