"""Build embed_page_fragment.html from gate index.html.""" from __future__ import annotations from pathlib import Path ROOT = Path(__file__).resolve().parent.parent src_lines = (ROOT / "crypto_monitor_gate" / "templates" / "index.html").read_text( encoding="utf-8" ).splitlines() # 1-based line numbers from index.html macro_body = src_lines[243:262] # {% macro %} … {% endmacro %} grid_inner = src_lines[328:736] # inside .grid (exclude outer wrapper) stats_block = src_lines[738:772] out_lines = [ "{# Hub iframe tab fragment — shared via embed_templates #}", *macro_body, '