From 5180dec43eae153f4361949098cdd7edc1dc2706 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 4 Jul 2026 12:53:05 +0200 Subject: [PATCH] ci(wiki): fix STYLE lists rendering as blockquotes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some pandoc versions (incl. the pinned 3.5) render scdoc bullet lists as a series of `> ·` blockquotes instead of a Markdown list, which made the STYLE sections look broken. Post-process the generated Markdown to collapse that artifact back into real `- item` bullets, independent of the pandoc version. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/wiki/generate.py | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/.github/wiki/generate.py b/.github/wiki/generate.py index 2db1e801..280ae34f 100755 --- a/.github/wiki/generate.py +++ b/.github/wiki/generate.py @@ -153,6 +153,35 @@ def fix_tables(md): return "\n".join(out) +BQ_BULLET = re.compile(r"^>\s*[·•‣∙⋅]\s*$") + + +def fix_blockquote_bullets(md): + """Turn pandoc's blockquote-wrapped bullet artifact into a real list. + + Some pandoc versions render a scdoc bullet list (`- *#clock*`) as a series + of blockquotes, each `> ·` / `>` / `> item`, instead of a Markdown list. + Collapse every such block back into a `- item` bullet. A no-op when pandoc + already produced a clean list. + """ + lines = md.split("\n") + out, i, n = [], 0, len(lines) + while i < n: + if BQ_BULLET.match(lines[i]): + j, content = i + 1, [] + while j < n and lines[j].startswith(">"): + cell = lines[j][1:].strip() + if cell: + content.append(cell) + j += 1 + out.append(f"- {' '.join(content)}" if content else "-") + i = j + else: + out.append(lines[i]) + i += 1 + return "\n".join(out) + + def pretty(basename): """waybar-sway-mode -> sway/mode (submodule heading for aggregated pages).""" return basename.removeprefix("waybar-").replace("-", "/", 1) @@ -173,7 +202,7 @@ def build_page(man_dir, sources, page, extras_dir): aggregated = len(sources) > 1 for src in sources: scd = os.path.join(man_dir, src + ".5.scd") - body = fix_tables(strip_sections(man_to_gfm(scd))) + body = fix_blockquote_bullets(fix_tables(strip_sections(man_to_gfm(scd)))) if aggregated: parts.append(f"\n# {pretty(src)}\n\n" + demote(body)) else: