fix(launcher): strip trailing LF from frontmatter body

The body region rebuilt from line-split included a trailing empty
entry from the final LF the parser appends to drive its gmatch. Strip
it so 'body text\n' (the on-disk content) parses to 'body text' (the
user-visible body), which is what the launcher-test asserts.
This commit is contained in:
Calic
2026-06-11 01:26:50 +02:00
parent 9d758e28c9
commit 1658aebe70

View File

@@ -37,6 +37,11 @@ local function split_at_separator(content)
for i = 2, sep_idx - 1 do json_lines[#json_lines + 1] = lines[i] end
local body_lines = {}
for i = sep_idx + 1, #lines do body_lines[#body_lines + 1] = lines[i] end
-- Drop the trailing empty entry produced by the final LF appended above,
-- so the body matches user expectation ('body text' rather than 'body text\n').
if #body_lines > 0 and body_lines[#body_lines] == "" then
body_lines[#body_lines] = nil
end
return table.concat(json_lines, "\n"), table.concat(body_lines, "\n")
end