From bb04aa6c800bc179d74fecc2ac2b4e810758b15d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:12:15 -0700 Subject: Drop the readme hooks that nothing reads Nothing in assets/ or in README's list of hooks reads a fenced block's data-lang or the manpage class on a man page's wrapper, so the header now names the two wrappers the stylesheet does style. --- custom/extensions/about-render.lua | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to 'custom/extensions') diff --git a/custom/extensions/about-render.lua b/custom/extensions/about-render.lua index 808dd08..9474225 100644 --- a/custom/extensions/about-render.lua +++ b/custom/extensions/about-render.lua @@ -3,8 +3,9 @@ -- interpreter so a readme costs no extra process per request. Markdown, man -- pages and plain text are the three formats, chosen from the readme's file -- extension, and anything that fails to parse falls back to escaped plain --- text. The wrappers it emits carry the classes that assets/cgit.css styles. --- It runs on Lua 5.1 through 5.5 and LuaJIT. +-- text. Markdown and man pages come out in div.markdown and plain text in +-- pre.plaintext, the two wrappers assets/cgit.css styles. It runs on Lua 5.1 +-- through 5.5 and LuaJIT. -- -- about-filter=lua:/usr/local/lib/cgit/filters/about-render.lua @@ -285,13 +286,7 @@ emit_blocks = function(blocks) elseif kind == "hr" then html("
") elseif kind == "code" then - html("
")
+			html("
")
 			html_txt(block.text)
 			html("
") elseif kind == "blockquote" then @@ -452,7 +447,6 @@ if has_lpeg then return nodes end - local lang_char = R("az", "AZ", "09") + S("_.+#-") local heading_line = C(P("#") * P("#") ^ -5) * space ^ 1 * C(P(1) ^ 0) -- A run of equals signs or dashes under a paragraph turns it into a -- heading, as on GitHub, rather than reading as more of its text. @@ -463,7 +457,7 @@ if has_lpeg then 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)) 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(">") @@ -548,7 +542,7 @@ if has_lpeg then local blocks, i, n = {}, 1, #lines while i <= n do local line = lines[i] - local fence, lang = fence_line:match(line) + local fence = fence_line:match(line) local hashes, title = heading_line:match(line) local mark = item_line:match(line) if line:match("^%s*$") then @@ -568,7 +562,6 @@ if has_lpeg then end blocks[#blocks + 1] = { kind = "code", - lang = lang, text = body, } elseif hashes then @@ -1007,7 +1000,7 @@ if has_lpeg then if not ok then return render_plaintext(text) end - html("
") + html("
") pcall(emit_blocks, blocks) html("
") end -- cgit