diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2012-01-28 12:36:51 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2012-01-28 12:36:51 -0800 |
commit | 0487eae7eea436957ddbe36256e244d2fb607e7b (patch) | |
tree | f4c8344e37dbcbd98673ce92f83893a7d15222f7 /src/Text/Pandoc/Readers | |
parent | d1ded4b0260b32550ac45329d7c43a82a7e7e911 (diff) | |
download | pandoc-0487eae7eea436957ddbe36256e244d2fb607e7b.tar.gz |
Markdown reader: Fixed bug in code block attribute parser.
Previously the ID attribute got lost if it didn't come first.
Now attributes can come in any order.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/Markdown.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs index fb04e88fe..47419defe 100644 --- a/src/Text/Pandoc/Readers/Markdown.hs +++ b/src/Text/Pandoc/Readers/Markdown.hs @@ -394,13 +394,14 @@ attributes = try $ do attrs <- many (attribute >>~ many spaceChar) char '}' let (ids, classes, keyvals) = unzip3 attrs - let id' = if null ids then "" else head ids - return (id', concat classes, concat keyvals) + let firstNonNull [] = "" + firstNonNull (x:xs) | not (null x) = x + | otherwise = firstNonNull xs + return (firstNonNull $ reverse ids, concat classes, concat keyvals) attribute :: GenParser Char st ([Char], [[Char]], [([Char], [Char])]) attribute = identifierAttr <|> classAttr <|> keyValAttr - identifier :: GenParser Char st [Char] identifier = do first <- letter |