diff options
author | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-12-31 01:12:44 +0000 |
---|---|---|
committer | fiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b> | 2009-12-31 01:12:44 +0000 |
commit | 3ec8772daff7d76097d7435c4e8da1df5ee4cc6a (patch) | |
tree | 9fc8b0101a1bd0016b619707f45bad9c6a2b9132 /src/Text/Pandoc/Readers/Markdown.hs | |
parent | 1a166987dfc049d03f034b920e4ae679402aa2f5 (diff) | |
download | pandoc-3ec8772daff7d76097d7435c4e8da1df5ee4cc6a.tar.gz |
Changed Meta author and date types to Inline lists instead of Strings.
Meta [Inline] [[Inline]] [Inline] rather than
Meta [Inline] [String] String.
This is a breaking change for libraries that use pandoc and
manipulate the metadata.
Changed .native files in test suite for new Meta format.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1699 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src/Text/Pandoc/Readers/Markdown.hs')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index 0de700537..8a09b191c 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -132,28 +132,27 @@ inlinesInBalancedBrackets parser = try $ do titleLine :: GenParser Char ParserState [Inline] titleLine = try $ char '%' >> skipSpaces >> manyTill inline newline -authorsLine :: GenParser Char st [String] +authorsLine :: GenParser Char ParserState [[Inline]] authorsLine = try $ do char '%' skipSpaces - authors <- sepEndBy (many1 (noneOf ",;\n")) (oneOf ",;") + authors <- sepEndBy (many1 (notFollowedBy (oneOf ",;\n") >> inline)) (oneOf ",;") newline - return $ map (decodeCharacterReferences . removeLeadingTrailingSpace) authors + return $ map normalizeSpaces authors -dateLine :: GenParser Char st String +dateLine :: GenParser Char ParserState [Inline] dateLine = try $ do char '%' skipSpaces - date <- many (noneOf "\n") - newline - return $ decodeCharacterReferences $ removeTrailingSpace date + date <- manyTill inline newline + return $ normalizeSpaces date -titleBlock :: GenParser Char ParserState ([Inline], [String], [Char]) +titleBlock :: GenParser Char ParserState ([Inline], [[Inline]], [Inline]) titleBlock = try $ do failIfStrict title <- option [] titleLine author <- option [] authorsLine - date <- option "" dateLine + date <- option [] dateLine optional blanklines return (title, author, date) @@ -175,7 +174,7 @@ parseMarkdown = do let reversedNotes = stateNotes st' updateState $ \s -> s { stateNotes = reverse reversedNotes } -- now parse it for real... - (title, author, date) <- option ([],[],"") titleBlock + (title, author, date) <- option ([],[],[]) titleBlock blocks <- parseBlocks return $ Pandoc (Meta title author date) $ filter (/= Null) blocks |