aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/MediaWiki.hs9
-rw-r--r--tests/writer.mediawiki7
2 files changed, 6 insertions, 10 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:
diff --git a/tests/writer.mediawiki b/tests/writer.mediawiki
index 314e7ab2f..9d89cd7bd 100644
--- a/tests/writer.mediawiki
+++ b/tests/writer.mediawiki
@@ -170,8 +170,6 @@ Multiple paragraphs:
** Tab
*** Tab
-
-
Here’s another:
# First
@@ -179,7 +177,6 @@ Here’s another:
#* Fee
#* Fie
#* Foe
-
# Third
Same thing but with paragraphs:
@@ -189,7 +186,6 @@ Same thing but with paragraphs:
#* Fee
#* Fie
#* Foe
-
# Third
== Tabs and spaces ==
@@ -199,7 +195,6 @@ Same thing but with paragraphs:
** this is an example list item indented with tabs
** this is an example list item indented with spaces
-
== Fancy list markers ==
<ol start="2" style="list-style-type: decimal;">
@@ -235,7 +230,6 @@ Autonumbering:
# More.
## Nested.
-
Should not be a list item:
M.A. 2007
@@ -313,7 +307,6 @@ Blank line after term, indented marker, alternate markers:
;# sublist
;# sublist
-
= HTML Blocks =
Simple block on one line: