authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-06-21 18:51:52 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2025-06-21 18:51:52 -07:00
log46d5986b679e5cbe544aa01fed92aabc2a95024f
treed812cea1dfbb5300b155485a11641408677063b2
parent104ef3caee949f2c02e5db2d72fec3b630917ae3

skip escaping a few more characters


2 files changed, 20 insertions(+), 4 deletions(-)

src/lib.zig+16
...@@ -392,6 +392,9 @@ fn nextCodepointSliceLossy(it: *std.unicode.Utf8Iterator) ?[]const u8 {...@@ -392,6 +392,9 @@ fn nextCodepointSliceLossy(it: *std.unicode.Utf8Iterator) ?[]const u8 {
392392
393fn isCodepointAnEntity(cp: u21) ?htmlentities.Entity {393fn isCodepointAnEntity(cp: u21) ?htmlentities.Entity {
394 switch (cp) {394 switch (cp) {
395 // '<', MUST NOT skip
396 // '<', MUST NOT skip
397 // '"', MUST NOT skip
395 '\n',398 '\n',
396 '.',399 '.',
397 ':',400 ':',
...@@ -409,6 +412,19 @@ fn isCodepointAnEntity(cp: u21) ?htmlentities.Entity {...@@ -409,6 +412,19 @@ fn isCodepointAnEntity(cp: u21) ?htmlentities.Entity {
409 '=',412 '=',
410 '-',413 '-',
411 ';',414 ';',
415 '#',
416 '{',
417 '}',
418 ',',
419 '*',
420 '!',
421 '\'',
422 '&',
423 '[',
424 ']',
425 '|',
426 '?',
427 '`',
412 => return null,428 => return null,
413 else => {},429 else => {},
414 }430 }
test.zig+4-4
...@@ -272,7 +272,7 @@ test { // string...@@ -272,7 +272,7 @@ test { // string
272 );272 );
273 try expect(builder.items).toEqualString(273 try expect(builder.items).toEqualString(
274 \\<body>274 \\<body>
275 \\ <p>This will show up because <code>bar</code> is &apos;foo&apos;.</p>275 \\ <p>This will show up because <code>bar</code> is 'foo'.</p>
276 \\</body>276 \\</body>
277 \\277 \\
278 );278 );
...@@ -299,7 +299,7 @@ test { // string false...@@ -299,7 +299,7 @@ test { // string false
299 );299 );
300 try expect(builder.items).toEqualString(300 try expect(builder.items).toEqualString(
301 \\<body>301 \\<body>
302 \\ <p>This will show up because <code>bar</code> is &apos;qux&apos;.</p>302 \\ <p>This will show up because <code>bar</code> is 'qux'.</p>
303 \\</body>303 \\</body>
304 \\304 \\
305 );305 );
...@@ -436,7 +436,7 @@ test { // string...@@ -436,7 +436,7 @@ test { // string
436 );436 );
437 try expect(builder.items).toEqualString(437 try expect(builder.items).toEqualString(
438 \\<body>438 \\<body>
439 \\ <p>This will show up because <code>bar</code> is &apos;qux&apos;.</p>439 \\ <p>This will show up because <code>bar</code> is 'qux'.</p>
440 \\</body>440 \\</body>
441 \\441 \\
442 );442 );
...@@ -463,7 +463,7 @@ test { // string false...@@ -463,7 +463,7 @@ test { // string false
463 );463 );
464 try expect(builder.items).toEqualString(464 try expect(builder.items).toEqualString(
465 \\<body>465 \\<body>
466 \\ <p>This will show up because <code>bar</code> is &apos;foo&apos;.</p>466 \\ <p>This will show up because <code>bar</code> is 'foo'.</p>
467 \\</body>467 \\</body>
468 \\468 \\
469 );469 );