diff --git a/actions/build_dashboard.py b/actions/build_dashboard.py index 0f590ae..067d762 100644 --- a/actions/build_dashboard.py +++ b/actions/build_dashboard.py @@ -17,6 +17,7 @@ from __future__ import annotations import datetime as _dt import html as _html import json +import re import sys from pathlib import Path @@ -113,6 +114,10 @@ tr:last-child td{border-bottom:none} .md hr{border:0;border-top:1px solid #232b38;margin:18px 0} .md blockquote{border-left:3px solid #2f5f96;margin:10px 0;padding:2px 14px;color:#b9c3d3} .md p.pending{border:1px dashed #3f5a7d;border-radius:8px;padding:10px 14px;color:#7f8aa0;background:#141821;margin:8px 0} +.md .sec{background:#141821;border:1px solid #2a2e3a;border-radius:12px;padding:4px 18px 14px;margin:16px 0} +.md .sec>h2:first-child{margin-top:.5em} +.md .subsec{background:#171a21;border:1px solid #262b36;border-left:3px solid #3f5a7d;border-radius:8px;padding:2px 16px 12px;margin:12px 0} +.md .subsec>h3:first-child{margin-top:.5em} """ # 页头/页脚:banner 结构(参考 FRA 模板) @@ -183,7 +188,26 @@ def render_md(text: str) -> str: out = _md.markdown(text, extensions=["tables", "fenced_code"]) except ImportError: out = "
" + _html.escape(text) + "
" - return out.replace("

(待登记)

", '

(待登记)

') + out = out.replace("

(待登记)

", '

(待登记)

') + return _wrap_sections(out) + + +def _wrap_sections(html: str) -> str: + """把渲染后的 HTML 按 h2 分大框、h3 分小框,便于阅读。""" + chunks = re.split(r"(?={s.strip()}' if s.strip().startswith("{inner}') + else: + out.append(c) + return "".join(out) def session_body(s: dict, files: list[tuple[str, str]]) -> str: