on master help sign in
#13, permit . in attribute names
commitfcf5588d52402a15a418689c1a8860d299e46402 authorNeil Mitchell <ndmitchell@gmail.com> dateFri 27 Oct 2017, 17:01 (9 years ago) parenta5d682e
3 files changed+3−2
CHANGES.txt+1 cbits/hexml.c+1−1 src/Main.hs+1−1
CHANGES.txt+1
@@ -1,5 +1,6 @@
11Changelog for Hexml
22
3+ #13, allow the . character in tags and attributes
340.3.2
45 #10, mark the small fast FFI calls as "unsafe" (up to 10x faster)
560.3.1
cbits/hexml.c+1−1
@@ -233,7 +233,7 @@ static void init_parse_table()
233233 for (int i = 0; i < 256; i++)
234234 {
235235 bool name1 = i == ':' || i == '_' || (i >= 'a' && i <= 'z') || (i >= 'A' && i <= 'Z');
236− bool name = name1 || i == '-' || (i >= '0' && i <= '9');
236+ bool name = name1 || i == '-' || i == '.' || (i >= '0' && i <= '9');
237237 bool space = i == ' ' || i == '\t' || i == '\r' || i == '\n';
238238 parse_table[i] = (name1 ? tag_name1 : 0) | (name ? tag_name : 0) | (space ? tag_space : 0);
239239 }
src/Main.hs+1−1
@@ -74,7 +74,7 @@ rerender = inside
7474 "</" <> name x <> ">"
7575 attr (Attribute a b) = validName a <> "=\"" <> validAttr b <> "\""
7676
77− validName x | BS.all (\x -> isAlphaNum x || x `elem` ("-:_" :: String)) x = x
77+ validName x | BS.all (\x -> isAlphaNum x || x `elem` ("-.:_" :: String)) x = x
7878 | otherwise = error "Invalid name"
7979 validAttr x | BS.notElem '\"' x = x
8080 | otherwise = error "Invalid attribute"