@@ -14,6 +14,8 @@ examples =
1414 [(True, "<test id=bob>here<extra/>there</test>")
1515 ,(True, "<test /><close />")
1616 ,(True, "<test id=\"bob value\" another-attr=\"test with <\">here </test> more text at the end<close />")
17+ ,(False, "<test></more>")
18+ ,(False, "<test")
1719 ]
1820
1921main :: IO ()
@@ -41,7 +43,7 @@ rerender = contents . documentNode
4143 "</" <> nodeName x <> ">"
4244 attr (Attribute a b) = validName a <> "=\"" <> validAttr b <> "\""
4345
44− validName x | BS.all (\x -> isAlpha x) x = x
46+ validName x | BS.all (\x -> isAlphaNum x || x `elem` ("-:_" :: String)) x = x
4547 | otherwise = error "Invalid name"
4648 validAttr x | BS.notElem '\"' x = x
4749 | otherwise = error "Invalid attribute"