diff options
| author | Rosa <rosaontheweb@proton.me> | 2026-05-18 22:00:32 -0400 |
|---|---|---|
| committer | Rosa <rosaontheweb@proton.me> | 2026-05-18 22:00:32 -0400 |
| commit | 7e2c764b24505e0f74e970d627f052899b94e374 (patch) | |
| tree | c2ae3c412002d4f8e66fc7700fa839d5df4d7fd5 /util/pages.zig | |
| parent | 1f0749100b22c17272b4d294e1db3034097b57ea (diff) | |
continue work on website build system
Diffstat (limited to 'util/pages.zig')
| -rw-r--r-- | util/pages.zig | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/util/pages.zig b/util/pages.zig index 13d62a1..1881aff 100644 --- a/util/pages.zig +++ b/util/pages.zig @@ -1,16 +1,27 @@ const std = @import("std"); -pub const Template = struct { - file: std.Io.File, +pub const pages = [_]Page{Page{ + .source_path = "index.html", + .template_path = "base.html", + .replacements = &[_]Replacement{ Replacement{ + .placeholder = "{{title}}", + .replacement = .{ .literal = "home" }, + }, Replacement{ + .placeholder = "{{body}}", + .replacement = .{ .file_content = {} }, + } }, +}}; - pub fn init(io: std.Io, dir: std.Io.Dir, sub_path: []const u8) !@This() { - const file = try dir.openFile(io, sub_path, .{}); - return .{ .file = file }; - } +const Page = struct { + source_path: []const u8, + template_path: []const u8, + replacements: []const Replacement, +}; - pub fn replacePlaceholder(template: *Template, key: []const u8, content: []u8) void { - _ = template; - _ = key; - _ = content; - } +const Replacement = struct { + placeholder: []const u8, + replacement: union(enum) { + file_content, + literal: []const u8, + }, }; |
