diff options
Diffstat (limited to 'src/z/html/parser.zig')
| -rw-r--r-- | src/z/html/parser.zig | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/z/html/parser.zig b/src/z/html/parser.zig index ee926f1..c85cc16 100644 --- a/src/z/html/parser.zig +++ b/src/z/html/parser.zig @@ -5,7 +5,7 @@ const Attribute = mod.Attribute; const Tag = mod.Tag; const Fragment = mod.Fragment; -const alphanumeric: []const u8 = std.ascii.letters ++ .{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; +const tag_name: []const u8 = std.ascii.letters ++ .{ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-' }; const void_elements: std.StaticStringMap(void) = .initComptime(.{ .{"area"}, .{"base"}, @@ -58,7 +58,7 @@ pub fn tag(buffer: []const u8) struct { Tag, []const u8 } { var buf: []const u8 = buffer[1..]; const name = name: { - const index = std.mem.findNone(u8, buf, alphanumeric) orelse @panic("uncosed tag"); + const index = std.mem.findNone(u8, buf, tag_name) orelse @panic("uncosed tag"); defer buf = buf[index..]; break :name buf[0..index]; }; @@ -137,7 +137,7 @@ pub fn attribute(buffer: []const u8) struct { Attribute, []const u8 } { buf = std.mem.trimStart(u8, buf, &std.ascii.whitespace); if (buf.len == 0 or buf[0] == '>') { - return .{ .name = name, .value = "" }; + return .{ .{ .name = name, .value = "" }, buf }; } if (buf[0] != '=') @panic("expected attr-eql"); |