aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
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