aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/z/App/root.zig5
-rw-r--r--src/z/html/parser.zig6
2 files changed, 6 insertions, 5 deletions
diff --git a/src/z/App/root.zig b/src/z/App/root.zig
index 8fce591..b8ca529 100644
--- a/src/z/App/root.zig
+++ b/src/z/App/root.zig
@@ -2,13 +2,14 @@ const builtin = @import("builtin");
const std = @import("std");
const Element = @import("../root.zig").html.Element;
const Document = @import("../root.zig").html.Document;
+const Fragment = @import("../root.zig").html.Fragment;
const Component = @import("../root.zig").Component;
pub const Options = struct {
name: []const u8,
globals: []const Global,
components: []const Component,
- body: Element,
+ body: Fragment,
theme: []const u8,
pub const Global = struct {
@@ -89,7 +90,7 @@ pub fn App(comptime options: Options) type {
break :reg register_code;
})}),
.node("script", .{}, &.{.text(@embedFile("main.js"))}),
- } ++ components ++ &[1]Element{options.body},
+ } ++ components ++ options.body.elements,
),
}),
};
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");