git.iko.soy/typeable/html-parse
on master help sign in
Fix treatment of attribute names

These also looped.

commitad978f32d558c7313075842472c686fb9fa678d8 authorBen Gamari <ben@smart-cactus.org> dateSun 14 May 2017, 11:14 (9 years ago) parent78ce9ca
1 file changed+6−4
Text/HTML/Parser.hs+6−4
Text/HTML/Parser.hs+6−4
@@ -150,11 +150,13 @@ beforeAttrName tag attrs = do
150150-- | /§8.2.4.33/: Attribute name state
151151attrName :: TagName -> [Attr] -> Parser Token
152152attrName tag attrs = do
153− name <- takeWhile $ notInClass "\x09\x0a\x0c /=<>\x00"
154− id $ (satisfy (inClass "\x09\x0a\x0c ") >> afterAttrName tag attrs name)
155− <|> (char '/' >> selfClosingStartTag tag attrs)
153+ name <- takeWhile $ notInClass "\x09\x0a\x0c /=>"
154+ id $ (endOfInput >> afterAttrName tag attrs name)
156155 <|> (char '=' >> beforeAttrValue tag attrs name)
157− <|> (char '>' >> return (TagOpen tag (Attr name T.empty : attrs)))
156+ <|> try (do mc <- peekChar
157+ case mc of
158+ Just c | inClass "\x09\x0a\x0c />" c -> afterAttrName tag attrs name
159+ _ -> empty)
158160 -- <|> -- TODO: NULL
159161
160162-- | /§8.2.4.34/: After attribute name state