mirror of
https://github.com/alpmestan/taggy.git
synced 2024-08-16 18:30:30 +03:00
(Forgivingly) permit ["/.] in attribute names.
This commit is contained in:
parent
9880f64013
commit
9f9480c049
@ -84,23 +84,11 @@ possibly c = (char c *> return ())
|
||||
|
||||
ident :: Parser T.Text
|
||||
ident =
|
||||
takeWhile1 (\c -> isAlphaNum c
|
||||
|| c == '-'
|
||||
|| c == '_'
|
||||
|| c == ':'
|
||||
|| c == '.'
|
||||
)
|
||||
takeWhile1 (\c -> isAlphaNum c || c `elem` "-_:.")
|
||||
|
||||
attribute_ident :: Parser T.Text
|
||||
attribute_ident =
|
||||
takeWhile1 (\c -> isAlphaNum c
|
||||
|| c == '-'
|
||||
|| c == '_'
|
||||
|| c == ':'
|
||||
|| c == '('
|
||||
|| c == ')'
|
||||
|| c == ','
|
||||
)
|
||||
takeWhile1 (\c -> isAlphaNum c || c `elem` "-_:(),\"/.")
|
||||
|
||||
tagopen :: Bool -> Parser Tag
|
||||
tagopen cventities = do
|
||||
|
@ -45,6 +45,13 @@ spec = do
|
||||
"<br / >" ~> tagopen False
|
||||
`shouldParse` TagOpen "br" [] True
|
||||
|
||||
it "successfully (and forgivingly) parses <title foo\">" $
|
||||
"<title foo\">" ~> tagopen False
|
||||
`shouldParse` TagOpen "title" [Attribute "foo\"" ""] False
|
||||
it "successfully (and forgivingly) parses <title https://github.com/alpmestan/taggy\">" $
|
||||
"<title https://github.com/alpmestan/taggy/\">" ~> tagopen False
|
||||
`shouldParse` TagOpen "title" [Attribute "https://github.com/alpmestan/taggy/\"" ""] False
|
||||
|
||||
it "can successfully convert entities in attribute values: <a title=\" Hello!\">" $
|
||||
"<a title=\" Hello!\">" ~> tagopen True
|
||||
`shouldParse` TagOpen "a" [Attribute "title" "\160Hello!"] False
|
||||
|
Loading…
Reference in New Issue
Block a user