RST reader: Combine para/plain.

This commit is contained in:
John MacFarlane 2012-09-28 22:14:03 -04:00
parent 4b65c2041c
commit 58909aaf21

View file

@ -228,15 +228,16 @@ lineBlock = try $ do
-- note: paragraph can end in a :: starting a code block -- note: paragraph can end in a :: starting a code block
para :: Parser [Char] ParserState Blocks para :: Parser [Char] ParserState Blocks
para = try $ do para = try $ do
result <- trimInlines . mconcat <$> many inline result <- trimInlines . mconcat <$> many1 inline
newline option (B.plain result) $ try $ do
blanklines newline
case viewr (B.unMany result) of blanklines
ys :> (Str xs) | "::" `isSuffixOf` xs -> do case viewr (B.unMany result) of
codeblock <- option mempty codeBlockBody ys :> (Str xs) | "::" `isSuffixOf` xs -> do
return $ B.para (B.Many ys <> B.str (take (length xs - 1) xs)) codeblock <- option mempty codeBlockBody
<> codeblock return $ B.para (B.Many ys <> B.str (take (length xs - 1) xs))
_ -> return (B.para result) <> codeblock
_ -> return (B.para result)
plain :: Parser [Char] ParserState Blocks plain :: Parser [Char] ParserState Blocks
plain = B.plain . trimInlines . mconcat <$> many1 inline plain = B.plain . trimInlines . mconcat <$> many1 inline