git.iko.soy/typeable/pandoc
on master help sign in
Allow empty lines when parsing line blocks
3e60ed9Albert Krewinkel
src/Text/Pandoc/Parsing.hs+5−2
@@ -718,11 +718,14 @@ lineBlockLine = try $ do
718 continuations <- many (try $ char ' ' >> anyLine)
718 continuations <- many (try $ char ' ' >> anyLine)
719 return $ white ++ unwords (line : continuations)
719 return $ white ++ unwords (line : continuations)
720
720
721+blankLineBlockLine :: Stream [Char] m Char => ParserT [Char] st m Char
722+blankLineBlockLine = try (char '|' >> blankline)
723+
721-- | Parses an RST-style line block and returns a list of strings.
724-- | Parses an RST-style line block and returns a list of strings.
722lineBlockLines :: Stream [Char] m Char => ParserT [Char] st m [String]
725lineBlockLines :: Stream [Char] m Char => ParserT [Char] st m [String]
723lineBlockLines = try $ do
726lineBlockLines = try $ do
724− lines' <- many1 lineBlockLine
727+ lines' <- many1 (lineBlockLine <|> ((:[]) <$> blankLineBlockLine))
725− skipMany1 $ blankline <|> try (char '|' >> blankline)
728+ skipMany1 $ blankline <|> blankLineBlockLine
726 return lines'
729 return lines'
727
730
728-- | Parse a table using 'headerParser', 'rowParser',
731-- | Parse a table using 'headerParser', 'rowParser',