diff --git a/.gitignore b/.gitignore index b5c98e3..4d574c5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ zig-cache/ node_modules # compiled template file -#generated.zig +generated.zig # IDE .vscode/ diff --git a/CLAUDE.md b/CLAUDE.md index 7541518..fba20d3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,6 +10,7 @@ Pugz is a Pug-like HTML template engine written in Zig 0.15.2. It implements Pug - Do not auto commit, user will do it. - At the start of each new session, read this CLAUDE.md file to understand project context and rules. - When the user specifies a new rule, update this CLAUDE.md file to include it. +- Code comments are required but must be meaningful, not bloated. Focus on explaining "why" not "what". Avoid obvious comments like "// increment counter" - instead explain complex logic, non-obvious decisions, or tricky edge cases. ## Build Commands diff --git a/build.zig.zon b/build.zig.zon index 1f2a21b..456a76c 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -1,6 +1,6 @@ .{ .name = .pugz, - .version = "0.1.11", + .version = "0.2.0", .fingerprint = 0x822db0790e17621d, // Changing this has security and trust implications. .minimum_zig_version = "0.15.2", .dependencies = .{}, diff --git a/src/benchmarks/templates/generated.zig b/src/benchmarks/templates/generated.zig index cbaa362..bfba16f 100644 --- a/src/benchmarks/templates/generated.zig +++ b/src/benchmarks/templates/generated.zig @@ -102,7 +102,7 @@ pub fn simple_1(a: Allocator, d: anytype) Allocator.Error![]u8 { try o.appendSlice(a, "!You have "); try esc(&o, a, strVal(@field(d, "messageCount"))); try o.appendSlice(a, " messages!"); - if (truthy(@field(d, "colors"))) { + if (@hasField(@TypeOf(d), "colors") and truthy(@field(d, "colors"))) { try o.appendSlice(a, "