update: svgNode

This commit is contained in:
Lucas F. 2026-01-20 19:04:08 -03:00
parent f0115a15b9
commit 1181f0fa68
4 changed files with 165 additions and 22 deletions

View file

@ -1068,3 +1068,33 @@ test "renderer - lorem paragraphs random" {
const spaces = std.mem.count(u8, buf.items, "<p>");
try testing.expect(spaces == 3);
}
test "renderer - svg" {
std.debug.print("____________________________________________________\n", .{});
std.debug.print("27 - svg\n", .{});
const alloc = testing.allocator;
var ctx = Context.init(alloc);
defer ctx.deinit();
var cache = TemplateCache.init(alloc);
try cache.initIcons();
defer cache.deinit();
const renderer = Renderer.init(&ctx, &cache);
const template =
\\{% svg material kangaroo %}
;
var buf = std.ArrayList(u8){};
defer buf.deinit(alloc);
try renderer.renderString(template, buf.writer(alloc));
std.debug.print("OUTPUT:\n\n{s}\n", .{buf.items});
try testing.expect(std.mem.indexOf(u8, buf.items, "<div class=\"svg-container\">") != null);
// const spaces = std.mem.count(u8, buf.items, "<p>");
// try testing.expect(spaces == 3);
}