"""Write the review report draft (.md canonical + .pdf rendition + self-check json) into a run folder. The PDF renderer is the one used for the Ungok P1 review report (Code/교각모델링/md_to_pdf.py: Malgun Gothic, U+2212 replaced, column min width = longest token); it is imported, not copied. """ import json import sys import time from pathlib import Path from engine import report LEGACY = Path(__file__).resolve().parents[2] / "교각모델링" def write(pier_dir, run_dir, author="", stale=(), out_of_scope=()): sys.path.insert(0, str(LEGACY)) import md_to_pdf # noqa: E402 (legacy renderer) today = time.strftime("%Y-%m-%d") md, d = report.build(pier_dir, run_dir, author, today, stale, out_of_scope) stem = f"보고서_{d['info']['name']}교각모델링검토_{today}_v0.1.00" run_dir = Path(run_dir) md_path, pdf_path = run_dir / f"{stem}.md", run_dir / f"{stem}.pdf" md_path.write_text(md, encoding="utf-8") md_to_pdf.build(md, pdf_path, f"{d['info']['name']} 교각 모델링 검토보고서 (초안)") chk = report.check(md, d) (run_dir / "report_check.json").write_text(json.dumps(chk, ensure_ascii=False, indent=1), encoding="utf-8") return {"md": md_path, "pdf": pdf_path, "check": chk}