diff options
author | John MacFarlane <jgm@berkeley.edu> | 2012-09-28 22:14:03 -0400 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2012-09-28 22:14:03 -0400 |
commit | 58909aaf219f1234b5bc61cc90dd745185c21435 (patch) | |
tree | 7cd5152469411fea944649b783989be38edbcbe1 /src/Text | |
parent | 4b65c2041c7d1ba938a2a1f76a983dd97930eb43 (diff) | |
download | pandoc-58909aaf219f1234b5bc61cc90dd745185c21435.tar.gz |
RST reader: Combine para/plain.
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Readers/RST.hs | 19 |
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 |