From 77ba3429e2616a95535706f5c79fe7bc85e5b4b1 Mon Sep 17 00:00:00 2001 From: fiddlosopher Date: Sun, 28 Feb 2010 11:21:19 +0000 Subject: Allow multi-line titles and authors in meta block. Based on a patch by Justin Bogner. Titles may span multiple lines, provided continuation lines begin with a space character. Separate authors may be put on multiple lines, provided each line after the first begins with a space character. Each author must fit on one line. Multiple authors on a single line may still be separated by a semicolon. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1854 788f1e2b-df1e-0410-8736-df70ead52e1b --- src/Text/Pandoc/Readers/Markdown.hs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index e0cc39ecc..029b40101 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -133,15 +133,23 @@ inlinesInBalancedBrackets parser = try $ do -- titleLine :: GenParser Char ParserState [Inline] -titleLine = try $ char '%' >> skipSpaces >> manyTill inline newline +titleLine = try $ do + char '%' + skipSpaces + res <- many $ (notFollowedBy newline >> inline) + <|> try (endline >> whitespace) + newline + return $ normalizeSpaces res authorsLine :: GenParser Char ParserState [[Inline]] authorsLine = try $ do char '%' skipSpaces - authors <- sepEndBy (many1 (notFollowedBy (oneOf ";\n") >> inline)) (oneOf ";") + authors <- sepEndBy (many (notFollowedBy (oneOf ";\n") >> inline)) + (char ';' <|> + try (newline >> notFollowedBy blankline >> spaceChar)) newline - return $ map normalizeSpaces authors + return $ filter (not . null) $ map normalizeSpaces authors dateLine :: GenParser Char ParserState [Inline] dateLine = try $ do -- cgit v1.2.3