git.iko.soy/typeable/pandoc
on master help sign in
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.

commit0487eae7eea436957ddbe36256e244d2fb607e7b authorJohn MacFarlane <fiddlosopher@gmail.com> dateSat 28 Jan 2012, 12:36 (15 years ago) parentd1ded4b
1 file changed+4−3
src/Text/Pandoc/Readers/Markdown.hs+4−3
src/Text/Pandoc/Readers/Markdown.hs+4−3
@@ -394,13 +394,14 @@ attributes = try $ do
394394 attrs <- many (attribute >>~ many spaceChar)
395395 char '}'
396396 let (ids, classes, keyvals) = unzip3 attrs
397− let id' = if null ids then "" else head ids
398− return (id', concat classes, concat keyvals)
397+ let firstNonNull [] = ""
398+ firstNonNull (x:xs) | not (null x) = x
399+ | otherwise = firstNonNull xs
400+ return (firstNonNull $ reverse ids, concat classes, concat keyvals)
399401
400402attribute :: GenParser Char st ([Char], [[Char]], [([Char], [Char])])
401403attribute = identifierAttr <|> classAttr <|> keyValAttr
402404
403−
404405identifier :: GenParser Char st [Char]
405406identifier = do
406407 first <- letter