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)
|
attrs <- many (attribute >>~ many spaceChar)
|
||||||
char '}'
|
char '}'
|
||||||
let (ids, classes, keyvals) = unzip3 attrs
|
let (ids, classes, keyvals) = unzip3 attrs
|
||||||
let id' = if null ids then "" else head ids
|
let firstNonNull [] = ""
|
||||||
return (id', concat classes, concat keyvals)
|
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 :: GenParser Char st ([Char], [[Char]], [([Char], [Char])])
|
||||||
attribute = identifierAttr <|> classAttr <|> keyValAttr
|
attribute = identifierAttr <|> classAttr <|> keyValAttr
|
||||||
|
|
||||||
|
|
||||||
identifier :: GenParser Char st [Char]
|
identifier :: GenParser Char st [Char]
|
||||||
identifier = do
|
identifier = do
|
||||||
first <- letter
|
first <- letter
|
||||||
|
|
Loading…
Add table
Reference in a new issue