authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-02-15 16:55:28 -08:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-02-15 16:55:28 -08:00
log20454a7042078cb90615e9461350c6bfa1bcf4bd
tree8ce5419cdf34217a135d8f86cdc566ce282ac295
parent49021184418ec124322660b4efb283481ec254b8

support apostrophe string


2 files changed, 40 insertions(+), 0 deletions(-)

src/tokenize.zig+5
......@@ -50,6 +50,11 @@ pub fn do(comptime input: string, comptime symbols: []const u8) []const Token {
5050 shouldFlush = false;
5151 break :blk;
5252 }
53 if (c == '\'') {
54 mode = 2;
55 shouldFlush = false;
56 break :blk;
57 }
5358 }
5459 if (mode == 1) {
5560 if (c == '\n') {
test.zig+35
......@@ -50,6 +50,41 @@ test "document" {
5050 );
5151}
5252
53test "apostrophe attribute string" {
54 const alloc = std.testing.allocator;
55 var builder = std.ArrayList(u8).init(alloc);
56 defer builder.deinit();
57 const doc = comptime pek.parse(
58 \\html[lang="en"](
59 \\ head(
60 \\ title("Pek Example")
61 \\ meta[charset="UTF-8"]
62 \\ meta[name="viewport" content="width=device-width,initial-scale=1"]
63 \\ meta[name="htmx-config" content='{"includeIndicatorStyles":false}']
64 \\ )
65 \\)
66 );
67 try pek.compile(
68 @This(),
69 alloc,
70 builder.writer(),
71 doc,
72 .{},
73 );
74 try expect(builder.items).toEqualString(
75 \\<!DOCTYPE html>
76 \\<html lang="en">
77 \\ <head>
78 \\ <title>Pek Example</title>
79 \\ <meta charset="UTF-8" />
80 \\ <meta name="viewport" content="width=device-width,initial-scale=1" />
81 \\ <meta name="htmx-config" content='{"includeIndicatorStyles":false}' />
82 \\ </head>
83 \\</html>
84 \\
85 );
86}
87
5388test "fragment" {
5489 const alloc = std.testing.allocator;
5590 var builder = std.ArrayList(u8).init(alloc);