Skip to content

Commit

Permalink
zig- update pek and it accepts an Allocator now
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro committed Aug 15, 2021
1 parent 050ec98 commit ce7f0c4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/handler/_internal.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ const http = @import("apple_pie");
const files = @import("self/files");
const pek = @import("pek");

pub fn writePageResponse(response: *http.Response, request: http.Request, comptime name: []const u8, data: anytype) !void {
pub fn writePageResponse(alloc: *std.mem.Allocator, response: *http.Response, request: http.Request, comptime name: []const u8, data: anytype) !void {
_ = request;
try response.headers.put("Content-Type", "text/html");

const w = response.writer();
const head = comptime files.open("/_header.pek").?;
const page = comptime files.open(name) orelse @compileError("file '" ++ name ++ "' not found in your files cache");
const tmpl = comptime pek.parse(head ++ page);
try pek.compile(w, tmpl, data);
try pek.compile(alloc, w, tmpl, data);
}
2 changes: 1 addition & 1 deletion src/handler/index.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const http = @import("apple_pie");
const _internal = @import("./_internal.zig");

pub fn get(_: void, response: *http.Response, request: http.Request) !void {
try _internal.writePageResponse(response, request, "/index.pek", .{
try _internal.writePageResponse(request.arena, response, request, "/index.pek", .{
.aquila_version = @import("root").version,
.logged_in = false,
});
Expand Down
2 changes: 1 addition & 1 deletion zigmod.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
2
git https://github.com/Luukdegram/apple_pie commit-132af7a66e0d63a19017e172c0ce59fd5b01d62a
git https://github.com/nektro/zig-pek commit-bcb022592b5751ff9acd5b9ac18d0dfea8fe447f
git https://github.com/nektro/zig-pek commit-499071c2903ee2b67460c0c3e8f0446cd232702f
git https://github.com/nektro/zig-range commit-890ca308fe09b3d5c866d5cfb3b3d7a95dbf939f
git https://github.com/kivikakk/htmlentities.zig commit-c3cbe4cb3a9a9bd60e7c9fedcf9b97e087b98d6c

0 comments on commit ce7f0c4

Please sign in to comment.