feat: add include demo page to showcase include directive

- Add includes/some_partial.pug partial in demo views
- Add pages/include-demo.pug page using include directive
- Add /include-demo route in demo server
- Add link to include demo in about page
- Fix test_includes.zig path in build.zig
- Add test_views for include testing
This commit is contained in:
2026-01-25 16:35:27 +05:30
parent 7bcb79c7bc
commit 9d3b729c6c
9 changed files with 59 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ pub fn main() !void {
defer _ = gpa.deinit();
const allocator = gpa.allocator();
// Test: Simple include from test_views
var engine = pugz.ViewEngine.init(allocator, .{
.views_dir = "test_views",
}) catch |err| {
@@ -21,4 +22,14 @@ pub fn main() !void {
defer allocator.free(html);
std.debug.print("=== Rendered HTML ===\n{s}\n=== End ===\n", .{html});
// Verify output contains included content
if (std.mem.indexOf(u8, html, "Included Partial") != null and
std.mem.indexOf(u8, html, "info-box") != null)
{
std.debug.print("\nSUCCESS: Include directive works correctly!\n", .{});
} else {
std.debug.print("\nFAILURE: Include content not found!\n", .{});
return error.TestFailed;
}
}