update: icons

This commit is contained in:
Lucas F. 2026-01-20 19:03:14 -03:00
parent cce0c6a954
commit 8fd9086d98

View file

@ -2,11 +2,13 @@ const std = @import("std");
const Allocator = std.heap.ArenaAllocator;
const parser = @import("parser.zig");
const icons = @import("svg/icons.zig");
pub const TemplateCache = struct {
arena: Allocator,
cache: std.StringHashMapUnmanaged([]parser.Node),
default_path: ?[]const u8 = "templates",
icons: ?icons.SvgIcon =null,
pub fn init(child_allocator: std.mem.Allocator) TemplateCache {
const arena = std.heap.ArenaAllocator.init(child_allocator);
@ -16,7 +18,6 @@ pub const TemplateCache = struct {
};
}
pub fn deinit(self: *TemplateCache) void {
self.arena.deinit();
}
@ -51,6 +52,10 @@ pub const TemplateCache = struct {
}
}
pub fn initIcons(self: *TemplateCache) !void {
self.icons = icons.SvgIcon.init(self.allocator()) catch null;
}
pub fn clear(self: *TemplateCache) void {
self.deinit();
self.cache = .{};