@@ -252,7 +252,7 @@ blockToRST (Table caption _ widths headers rows) = do
252blockToRST (BulletList items) = do
252blockToRST (BulletList items) = do
253 contents <- mapM bulletListItemToRST items
253 contents <- mapM bulletListItemToRST items
254 -- ensure that sublists have preceding blank line
254 -- ensure that sublists have preceding blank line
255− return $ blankline $$ vcat contents $$ blankline
255+ return $ blankline $$ chomp (vcat contents) $$ blankline
256blockToRST (OrderedList (start, style', delim) items) = do
256blockToRST (OrderedList (start, style', delim) items) = do
257 let markers = if start == 1 && style' == DefaultStyle && delim == DefaultDelim
257 let markers = if start == 1 && style' == DefaultStyle && delim == DefaultDelim
258 then take (length items) $ repeat "#."
258 then take (length items) $ repeat "#."
@@ -264,17 +264,17 @@ blockToRST (OrderedList (start, style', delim) items) = do
264 contents <- mapM (\(item, num) -> orderedListItemToRST item num) $
264 contents <- mapM (\(item, num) -> orderedListItemToRST item num) $
265 zip markers' items
265 zip markers' items
266 -- ensure that sublists have preceding blank line
266 -- ensure that sublists have preceding blank line
267− return $ blankline $$ vcat contents $$ blankline
267+ return $ blankline $$ chomp (vcat contents) $$ blankline
268blockToRST (DefinitionList items) = do
268blockToRST (DefinitionList items) = do
269 contents <- mapM definitionListItemToRST items
269 contents <- mapM definitionListItemToRST items
270 -- ensure that sublists have preceding blank line
270 -- ensure that sublists have preceding blank line
271− return $ blankline $$ vcat contents $$ blankline
271+ return $ blankline $$ chomp (vcat contents) $$ blankline
273-- | Convert bullet list item (list of blocks) to RST.
273-- | Convert bullet list item (list of blocks) to RST.
274bulletListItemToRST :: [Block] -> State WriterState Doc
274bulletListItemToRST :: [Block] -> State WriterState Doc
275bulletListItemToRST items = do
275bulletListItemToRST items = do
276 contents <- blockListToRST items
276 contents <- blockListToRST items
277− return $ hang 3 "- " contents
277+ return $ hang 3 "- " $ contents <> cr
279-- | Convert ordered list item (a list of blocks) to RST.
279-- | Convert ordered list item (a list of blocks) to RST.
280orderedListItemToRST :: String -- ^ marker for list item
280orderedListItemToRST :: String -- ^ marker for list item
@@ -283,7 +283,7 @@ orderedListItemToRST :: String -- ^ marker for list item
283orderedListItemToRST marker items = do
283orderedListItemToRST marker items = do
284 contents <- blockListToRST items
284 contents <- blockListToRST items
285 let marker' = marker ++ " "
285 let marker' = marker ++ " "
286− return $ hang (length marker') (text marker') contents
286+ return $ hang (length marker') (text marker') $ contents <> cr
288-- | Convert defintion list item (label, list of blocks) to RST.
288-- | Convert defintion list item (label, list of blocks) to RST.
289definitionListItemToRST :: ([Inline], [[Block]]) -> State WriterState Doc
289definitionListItemToRST :: ([Inline], [[Block]]) -> State WriterState Doc
@@ -291,7 +291,7 @@ definitionListItemToRST (label, defs) = do
291 label' <- inlineListToRST label
291 label' <- inlineListToRST label
292 contents <- liftM vcat $ mapM blockListToRST defs
292 contents <- liftM vcat $ mapM blockListToRST defs
293 tabstop <- get >>= (return . writerTabStop . stOptions)
293 tabstop <- get >>= (return . writerTabStop . stOptions)
294− return $ label' $$ nest tabstop (nestle contents)
294+ return $ label' $$ nest tabstop (nestle contents <> cr)
296-- | Convert list of Pandoc block elements to RST.
296-- | Convert list of Pandoc block elements to RST.
297blockListToRST :: [Block] -- ^ List of block elements
297blockListToRST :: [Block] -- ^ List of block elements