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.
This commit is contained in:
parent
d1ded4b026
commit
0487eae7ee
1 changed files with 4 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue