From 58909aaf219f1234b5bc61cc90dd745185c21435 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Fri, 28 Sep 2012 22:14:03 -0400 Subject: RST reader: Combine para/plain. --- src/Text/Pandoc/Readers/RST.hs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/Text') 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 -- cgit v1.2.3