Improvements to markdown attributes syntax (on code blocks).
(1) Attributes can contain line breaks. (2) Values in key-value attributes can be surrounded by either double or single quotes, or left unquoted if they contain no spaces.
This commit is contained in:
parent
ef5dcae211
commit
24f7076622
1 changed files with 5 additions and 4 deletions
|
@ -390,8 +390,8 @@ blockDelimiter f len = try $ do
|
|||
attributes :: GenParser Char st ([Char], [[Char]], [([Char], [Char])])
|
||||
attributes = try $ do
|
||||
char '{'
|
||||
many spaceChar
|
||||
attrs <- many (attribute >>~ many spaceChar)
|
||||
spnl
|
||||
attrs <- many (attribute >>~ spnl)
|
||||
char '}'
|
||||
let (ids, classes, keyvals) = unzip3 attrs
|
||||
let firstNonNull [] = ""
|
||||
|
@ -424,8 +424,9 @@ keyValAttr :: GenParser Char st ([Char], [a], [([Char], [Char])])
|
|||
keyValAttr = try $ do
|
||||
key <- identifier
|
||||
char '='
|
||||
char '"'
|
||||
val <- manyTill (satisfy (/='\n')) (char '"')
|
||||
val <- enclosed (char '"') (char '"') anyChar
|
||||
<|> enclosed (char '\'') (char '\'') anyChar
|
||||
<|> many nonspaceChar
|
||||
return ("",[],[(key,val)])
|
||||
|
||||
codeBlockDelimited :: GenParser Char st Block
|
||||
|
|
Loading…
Add table
Reference in a new issue