aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2016-10-13 08:46:44 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2016-10-13 08:46:44 +0200
commit3e60ed9c039d90fc0c9001cd0a123ed8bb38eac7 (patch)
treedf74e1ccd86d8b2737d86ca50b560114444d360e /src
parentc9460e7013d395f77f75a4eb6bde933ffc34b6b6 (diff)
downloadpandoc-3e60ed9c039d90fc0c9001cd0a123ed8bb38eac7.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Parsing.hs7
1 files changed, 5 insertions, 2 deletions
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',