From b04dfde403b4b43dbdf046f37c0b240e6f8af488 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Tue, 18 Jun 2013 10:04:37 -0700 Subject: RST reader: don't insert paragraphs where docutils doesn't. rst2html doesn't add `

` tags to list items (even when they are separated by blank lines) unless there are multiple paragraphs in the list. This commit changes the RST reader to conform more closely to what docutils does. Closes #880. --- src/Text/Pandoc/Readers/RST.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/Text/Pandoc/Readers') diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index 9bd832d14..4e0c0a277 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -441,7 +441,12 @@ listItem start = try $ do -- parse the extracted block, which may itself contain block elements parsed <- parseFromString parseBlocks $ concat (first:rest) ++ blanks updateState (\st -> st {stateParserContext = oldContext}) - return parsed + return $ case B.toList parsed of + [Para xs] -> B.singleton $ Plain xs + [Para xs, BulletList ys] -> B.fromList [Plain xs, BulletList ys] + [Para xs, OrderedList s ys] -> B.fromList [Plain xs, OrderedList s ys] + [Para xs, DefinitionList ys] -> B.fromList [Plain xs, DefinitionList ys] + _ -> parsed orderedList :: RSTParser Blocks orderedList = try $ do -- cgit v1.2.3