aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-02-28 11:21:19 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2010-02-28 11:21:19 +0000
commit77ba3429e2616a95535706f5c79fe7bc85e5b4b1 (patch)
treef10dfe6046364abbf205b9d4ec6df4f1aaaa9c3e /src
parent36675bd20612fc75df97dda3a3c0d2a5b694f83c (diff)
downloadpandoc-77ba3429e2616a95535706f5c79fe7bc85e5b4b1.tar.gz
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
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Markdown.hs14
1 files changed, 11 insertions, 3 deletions
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