~subsetpark/erasmus

407cdb0b087a40146fbca6e7aacc898c949449be — Zach Smith 2 months ago 1c1b9c8
Escape backlinks also
1 files changed, 14 insertions(+), 1 deletions(-)

M src/main.zig
M src/main.zig => src/main.zig +14 -1
@@ 192,7 192,20 @@ fn appendBacklinks(
        const items = other_note.body.items;
        if (mem.indexOf(u8, items, link_here) != null) {
            found_one = true;
            try appendRef(note, other_note.name, allocator);

            var escaped = EscapedString{
                .escaped = try CharBuffer.initCapacity(allocator, other_note.name.len * 2),
                .error_slice = undefined,
            };
            defer escaped.escaped.deinit();

            escape(other_note.name, &escaped) catch {
                std.debug.print("Found illegal character in brackets: `{s}`\n", .{
                    escaped.error_slice,
                });
                std.os.exit(1);
            };
            try appendRef(note, escaped.escaped.items, allocator);
        }
    }