aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-25 12:28:48 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-25 12:34:44 -0800
commitd8fde9547e2e684cb892b1c38a5c01cf4aec0fe9 (patch)
tree243f9bdc358c2fc3df17416826d07ed74e1db1f3 /src/Text
parent25e2c42347b9bf71b765984d3d897fae8b1a2edb (diff)
downloadpandoc-d8fde9547e2e684cb892b1c38a5c01cf4aec0fe9.tar.gz
Reverted "omit blank lines after list items," better fix for #1777.
Now we do as before, including blank lines after list items in loose lists (even though RST doesn't care -- this is just a matter of visual appeal). But we chomp any excess whitespace after the last list item, which solves #1777.
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/Writers/RST.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/RST.hs b/src/Text/Pandoc/Writers/RST.hs
index 85d395f52..5ba4c9983 100644
--- a/src/Text/Pandoc/Writers/RST.hs
+++ b/src/Text/Pandoc/Writers/RST.hs
@@ -252,7 +252,7 @@ blockToRST (Table caption _ widths headers rows) = do
blockToRST (BulletList items) = do
contents <- mapM bulletListItemToRST items
-- ensure that sublists have preceding blank line
- return $ blankline $$ vcat contents $$ blankline
+ return $ blankline $$ chomp (vcat contents) $$ blankline
blockToRST (OrderedList (start, style', delim) items) = do
let markers = if start == 1 && style' == DefaultStyle && delim == DefaultDelim
then take (length items) $ repeat "#."
@@ -264,17 +264,17 @@ blockToRST (OrderedList (start, style', delim) items) = do
contents <- mapM (\(item, num) -> orderedListItemToRST item num) $
zip markers' items
-- ensure that sublists have preceding blank line
- return $ blankline $$ vcat contents $$ blankline
+ return $ blankline $$ chomp (vcat contents) $$ blankline
blockToRST (DefinitionList items) = do
contents <- mapM definitionListItemToRST items
-- ensure that sublists have preceding blank line
- return $ blankline $$ vcat contents $$ blankline
+ return $ blankline $$ chomp (vcat contents) $$ blankline
-- | Convert bullet list item (list of blocks) to RST.
bulletListItemToRST :: [Block] -> State WriterState Doc
bulletListItemToRST items = do
contents <- blockListToRST items
- return $ hang 3 "- " contents
+ return $ hang 3 "- " $ contents <> cr
-- | Convert ordered list item (a list of blocks) to RST.
orderedListItemToRST :: String -- ^ marker for list item
@@ -283,7 +283,7 @@ orderedListItemToRST :: String -- ^ marker for list item
orderedListItemToRST marker items = do
contents <- blockListToRST items
let marker' = marker ++ " "
- return $ hang (length marker') (text marker') contents
+ return $ hang (length marker') (text marker') $ contents <> cr
-- | Convert defintion list item (label, list of blocks) to RST.
definitionListItemToRST :: ([Inline], [[Block]]) -> State WriterState Doc
@@ -291,7 +291,7 @@ definitionListItemToRST (label, defs) = do
label' <- inlineListToRST label
contents <- liftM vcat $ mapM blockListToRST defs
tabstop <- get >>= (return . writerTabStop . stOptions)
- return $ label' $$ nest tabstop (nestle contents)
+ return $ label' $$ nest tabstop (nestle contents <> cr)
-- | Convert list of Pandoc block elements to RST.
blockListToRST :: [Block] -- ^ List of block elements