"""The static report page: chart above tables, cells identical to the terminal's.""" from __future__ import annotations import re from html import unescape from devstats.aggregate import Window from devstats.report_html import CMDR, KUHY, chart, page from devstats.render import report def window(days: int, net: int) -> Window: return Window(days=days, code_ins=max(net, 0), code_del=max(-net, 0), docs_ins=5, docs_del=1, excluded_lines=10, all_lines=100, active_days=3, commits=7, tags=2, repos_with_tags=1) WINDOWS = [window(30, 3000), window(90, 900), window(300, 30)] def md_cells(text: str) -> list[str]: """Body cells of every markdown table (header and separator rows skipped).""" cells = [] for block in text.split("## ")[1:]: rows = [ln for ln in block.splitlines() if ln.startswith("|")][2:] cells += [c.strip() for r in rows for c in r.strip("|").split("|")] return cells def test_page_cells_match_the_terminal_tables() -> None: html = page(WINDOWS, "2026-11-27") tds = [unescape(c) for c in re.findall(r"