aboutsummaryrefslogtreecommitdiff
path: root/src/z/html/parser.zig
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2026-10-08 19:57:40 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2026-10-08 19:58:40 +0200
commitd0a2f9b05a5df95f3d2800cb899c998d3c8d5fb6 (patch)
tree318d963894c138edad769dc08da730df7587aec6 /src/z/html/parser.zig
parent3d0d5d88458112e5cc276f650e02609dc85c5b87 (diff)
html-parser: fix custom element parsing
Diffstat (limited to 'src/z/html/parser.zig')
-rw-r--r--src/z/html/parser.zig6
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");