Allow '|' followed by newline in RST line block.

This commit is contained in:
John MacFarlane 2011-04-11 14:45:42 -07:00
parent 6b282fda5b
commit 4b90ffe1bd
2 changed files with 9 additions and 3 deletions

View file

@ -17,7 +17,10 @@ infix 5 =:
(=:) = test rst
tests :: [Test]
tests = [ "field list" =:
tests = [ "line block with blank line" =:
"| a\n|\n| b" =?> para (str "a" +++ linebreak +++
linebreak +++ str " " +++ str "b")
, "field list" =:
[_LIT|
:Hostname: media08
:IP address: 10.0.0.19

View file

@ -198,11 +198,14 @@ fieldList = try $ do
lineBlockLine :: GenParser Char ParserState [Inline]
lineBlockLine = try $ do
string "| "
char '|'
char ' ' <|> lookAhead (char '\n')
white <- many spaceChar
line <- many $ (notFollowedBy newline >> inline) <|> (try $ endline >>~ char ' ')
optional endline
return $ normalizeSpaces $ (if null white then [] else [Str white]) ++ line
return $ if null white
then normalizeSpaces line
else Str white : normalizeSpaces line
lineBlock :: GenParser Char ParserState Block
lineBlock = try $ do