From d8a045c91469b1d121b8fd14dffaa367b194831d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 6 Sep 2026 21:46:52 -1000 Subject: Clean up the whole tree --- custom/extensions/about-render.lua | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'custom/extensions/about-render.lua') diff --git a/custom/extensions/about-render.lua b/custom/extensions/about-render.lua index f4e7685..805265e 100644 --- a/custom/extensions/about-render.lua +++ b/custom/extensions/about-render.lua @@ -259,20 +259,17 @@ if has_lpeg then local lang_char = R("az", "AZ", "09") + S("_.+#-") local heading_line = C(P("#") * P("#") ^ -5) * space ^ 1 * C(P(1) ^ 0) local function thematic(mark) - return space ^ 0 * P(mark) * (space ^ 0 * P(mark)) ^ 2 - * space ^ 0 * eol + return space ^ 0 * P(mark) * (space ^ 0 * P(mark)) ^ 2 * space ^ 0 * eol end local break_line = thematic("-") + thematic("*") + thematic("_") - local fence_line = space ^ 0 * (C(P("`") ^ 3) + C(P("~") ^ 3)) - * space ^ 0 * C(lang_char ^ 0) + local fence_line = space ^ 0 * (C(P("`") ^ 3) + C(P("~") ^ 3)) * space ^ 0 * C(lang_char ^ 0) local close_backtick = space ^ 0 * P("`") ^ 3 * space ^ 0 * eol local close_tilde = space ^ 0 * P("~") ^ 3 * space ^ 0 * eol local quote_line = space ^ 0 * P(">") local bullet = S("-*+") local number = R("09") ^ 1 * S(".)") local item_line = space ^ 0 * C(bullet + number) * space ^ 1 * C(P(1) ^ 0) - local dash_cell = space ^ 0 * P(":") ^ -1 * P("-") ^ 1 * P(":") ^ -1 - * space ^ 0 + local dash_cell = space ^ 0 * P(":") ^ -1 * P("-") ^ 1 * P(":") ^ -1 * space ^ 0 -- A delimiter row is dash-cells joined by pipes. Require at least one -- pipe, a leading one or one between cells, so a bare rule of dashes -- stays a thematic break and an ordinary paragraph line is never taken @@ -299,8 +296,7 @@ if has_lpeg then if line:match("^%s*$") then i = i + 1 elseif fence then - local close = (fence:sub(1, 1) == "`") - and close_backtick or close_tilde + local close = (fence:sub(1, 1) == "`") and close_backtick or close_tilde local code = {} i = i + 1 while i <= n and not close:match(lines[i]) do @@ -345,16 +341,14 @@ if has_lpeg then lines = paragraph, } end - elseif i + 1 <= n and line:find("|", 1, true) - and table_delimiter:match(lines[i + 1]) then + elseif i + 1 <= n and line:find("|", 1, true) and table_delimiter:match(lines[i + 1]) then local head = {} for _, cell in ipairs(split_cells(line)) do head[#head + 1] = parse_inline(cell) end local rows = {} i = i + 2 - while i <= n and lines[i]:find("|", 1, true) - and not lines[i]:match("^%s*$") do + while i <= n and lines[i]:find("|", 1, true) and not lines[i]:match("^%s*$") do local row = {} for _, cell in ipairs(split_cells(lines[i])) do row[#row + 1] = parse_inline(cell) @@ -386,8 +380,7 @@ if has_lpeg then else local paragraph = { parse_inline(line) } i = i + 1 - while i <= n and not lines[i]:match("^%s*$") - and not block_start:match(lines[i]) do + while i <= n and not lines[i]:match("^%s*$") and not block_start:match(lines[i]) do paragraph[#paragraph + 1] = parse_inline(lines[i]) i = i + 1 end @@ -416,8 +409,7 @@ if has_lpeg then -- Roff fonts are a current state carried across a run rather than -- opened and closed, so the inline pass tokenises to a flat list -- and folds it into the nodes markdown emits, instead of nesting. - local macro_line = S(".'") * space ^ 0 * C((1 - space) ^ 1) - * space ^ 0 * C(P(1) ^ 0) + local macro_line = S(".'") * space ^ 0 * C((1 - space) ^ 1) * space ^ 0 * C(P(1) ^ 0) local one_font = { B = "B", I = "I" } local two_font = { CB = "B", BI = "B", CI = "I" } @@ -535,8 +527,7 @@ if has_lpeg then flush_paragraph(); nofill = true; nofill_lines = {} elseif macro == "fi" then flush_nofill() - elseif macro == "B" or macro == "BR" or macro == "RB" - or macro == "BI" or macro == "IB" then + elseif macro == "B" or macro == "BR" or macro == "RB" or macro == "BI" or macro == "IB" then add_line({ { kind = "strong", kids = man_inline(rest) } }) elseif macro == "I" or macro == "IR" or macro == "RI" then add_line({ { kind = "em", kids = man_inline(rest) } }) -- cgit v2.8.0