diff --git a/src/tokenize.zig b/src/tokenize.zig index a839dc3b7fb87ecc7ff2fef81349bfc3fc23b5aa..52f7af63380e5999c42cae99b0ba5833174e3089 100644 --- a/src/tokenize.zig +++ b/src/tokenize.zig @@ -50,6 +50,11 @@ pub fn do(comptime input: string, comptime symbols: []const u8) []const Token { shouldFlush = false; break :blk; } + if (c == '\'') { + mode = 2; + shouldFlush = false; + break :blk; + } } if (mode == 1) { if (c == '\n') { diff --git a/test.zig b/test.zig index 6a78079d764880474fd759c7598efb4ce41b2ae3..2fd9ef09a956a366647a8e9b4a5e69fbd50d48e8 100644 --- a/test.zig +++ b/test.zig @@ -50,6 +50,41 @@ test "document" { ); } +test "apostrophe attribute string" { + const alloc = std.testing.allocator; + var builder = std.ArrayList(u8).init(alloc); + defer builder.deinit(); + const doc = comptime pek.parse( + \\html[lang="en"]( + \\ head( + \\ title("Pek Example") + \\ meta[charset="UTF-8"] + \\ meta[name="viewport" content="width=device-width,initial-scale=1"] + \\ meta[name="htmx-config" content='{"includeIndicatorStyles":false}'] + \\ ) + \\) + ); + try pek.compile( + @This(), + alloc, + builder.writer(), + doc, + .{}, + ); + try expect(builder.items).toEqualString( + \\ + \\ + \\
+ \\