From 4b90ffe1bd481c9330ffdad455676df6fe2fa6d4 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Mon, 11 Apr 2011 14:45:42 -0700 Subject: Allow '|' followed by newline in RST line block. --- src/Tests/Readers/RST.hs | 5 ++++- src/Text/Pandoc/Readers/RST.hs | 7 +++++-- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Tests/Readers/RST.hs b/src/Tests/Readers/RST.hs index 3ca4e42bf..4b8c9301b 100644 --- a/src/Tests/Readers/RST.hs +++ b/src/Tests/Readers/RST.hs @@ -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 diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index 736219d68..04bb33023 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -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 -- cgit v1.2.3