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 {
392392
393393fn isCodepointAnEntity(cp: u21) ?htmlentities.Entity {
394394 switch (cp) {
395 // '<', MUST NOT skip
396 // '<', MUST NOT skip
397 // '"', MUST NOT skip
395398 '\n',
396399 '.',
397400 ':',
......@@ -409,6 +412,19 @@ fn isCodepointAnEntity(cp: u21) ?htmlentities.Entity {
409412 '=',
410413 '-',
411414 ';',
415 '#',
416 '{',
417 '}',
418 ',',
419 '*',
420 '!',
421 '\'',
422 '&',
423 '[',
424 ']',
425 '|',
426 '?',
427 '`',
412428 => return null,
413429 else => {},
414430 }
test.zig+4-4
......@@ -272,7 +272,7 @@ test { // string
272272 );
273273 try expect(builder.items).toEqualString(
274274 \\<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>
276276 \\</body>
277277 \\
278278 );
......@@ -299,7 +299,7 @@ test { // string false
299299 );
300300 try expect(builder.items).toEqualString(
301301 \\<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>
303303 \\</body>
304304 \\
305305 );
......@@ -436,7 +436,7 @@ test { // string
436436 );
437437 try expect(builder.items).toEqualString(
438438 \\<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>
440440 \\</body>
441441 \\
442442 );
......@@ -463,7 +463,7 @@ test { // string false
463463 );
464464 try expect(builder.items).toEqualString(
465465 \\<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>
467467 \\</body>
468468 \\
469469 );