From 3e60ed9c039d90fc0c9001cd0a123ed8bb38eac7 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Thu, 13 Oct 2016 08:46:44 +0200 Subject: Allow empty lines when parsing line blocks Line blocks are allowed to contain empty lines and should be parsed as a single block in that case. Previously an empty (line block) line would have terminated parsing of the line block element. --- src/Text/Pandoc/Parsing.hs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs index e45e2247d..daf8e867d 100644 --- a/src/Text/Pandoc/Parsing.hs +++ b/src/Text/Pandoc/Parsing.hs @@ -718,11 +718,14 @@ lineBlockLine = try $ do continuations <- many (try $ char ' ' >> anyLine) return $ white ++ unwords (line : continuations) +blankLineBlockLine :: Stream [Char] m Char => ParserT [Char] st m Char +blankLineBlockLine = try (char '|' >> blankline) + -- | Parses an RST-style line block and returns a list of strings. lineBlockLines :: Stream [Char] m Char => ParserT [Char] st m [String] lineBlockLines = try $ do - lines' <- many1 lineBlockLine - skipMany1 $ blankline <|> try (char '|' >> blankline) + lines' <- many1 (lineBlockLine <|> ((:[]) <$> blankLineBlockLine)) + skipMany1 $ blankline <|> blankLineBlockLine return lines' -- | Parse a table using 'headerParser', 'rowParser', -- cgit v1.2.3