"""Reproduce the original publication CSS/SVG, scoped to the accepted runtime shell.""" import json import re import sys from pathlib import Path from css_scope import scope_css ROOT = Path(__file__).resolve().parents[1] def main(): target = ROOT / "src/site_engine/web/admin" css = (ROOT / "design/assets/publication.css").read_text() css = re.sub(r"(?{%- endmacro %}\n', target / "static/publication-icons.json": json.dumps(icons, ensure_ascii=False) + "\n", } for path, content in output.items(): if "--check" in sys.argv: if not path.exists() or path.read_text() != content: raise SystemExit(f"Publication design out of date: {path}") else: path.write_text(content) if __name__ == "__main__": main()