summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2012-09-28 22:14:03 -0400
committerJohn MacFarlane <jgm@berkeley.edu>2012-09-28 22:14:03 -0400
commit58909aaf219f1234b5bc61cc90dd745185c21435 (patch)
tree7cd5152469411fea944649b783989be38edbcbe1 /src
parent4b65c2041c7d1ba938a2a1f76a983dd97930eb43 (diff)
RST reader: Combine para/plain.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs
index 7631cabdb..0bcffd709 100644
--- a/src/Text/Pandoc/Readers/RST.hs
+++ b/src/Text/Pandoc/Readers/RST.hs
@@ -228,15 +228,16 @@ lineBlock = try $ do
-- note: paragraph can end in a :: starting a code block
para :: Parser [Char] ParserState Blocks
para = try $ do
- result <- trimInlines . mconcat <$> many inline
- newline
- blanklines
- case viewr (B.unMany result) of
- ys :> (Str xs) | "::" `isSuffixOf` xs -> do
- codeblock <- option mempty codeBlockBody
- return $ B.para (B.Many ys <> B.str (take (length xs - 1) xs))
- <> codeblock
- _ -> return (B.para result)
+ result <- trimInlines . mconcat <$> many1 inline
+ option (B.plain result) $ try $ do
+ newline
+ blanklines
+ case viewr (B.unMany result) of
+ ys :> (Str xs) | "::" `isSuffixOf` xs -> do
+ codeblock <- option mempty codeBlockBody
+ return $ B.para (B.Many ys <> B.str (take (length xs - 1) xs))
+ <> codeblock
+ _ -> return (B.para result)
plain :: Parser [Char] ParserState Blocks
plain = B.plain . trimInlines . mconcat <$> many1 inline