aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-06-18 10:04:37 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2013-06-18 10:04:37 -0700
commitb04dfde403b4b43dbdf046f37c0b240e6f8af488 (patch)
tree264ba6d668c3a03b1754b362e789dc00a0cfc1f7 /src/Text/Pandoc/Readers
parenta43e0ad5d683aec901622bd0cef8fa6fa47b7c59 (diff)
downloadpandoc-b04dfde403b4b43dbdf046f37c0b240e6f8af488.tar.gz
RST reader: don't insert paragraphs where docutils doesn't.
rst2html doesn't add `<p>` 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.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs7
1 files changed, 6 insertions, 1 deletions
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