""" Extract FAQ Q&A pairs from product pages and inject as `faq={[...]}` prop. Pattern detected:
...answer...
Only operates on pages that have a FAQ section (search for 'คำถามที่พบบ่อย'). """ import re from pathlib import Path ROOT = Path(__file__).resolve().parent.parent PAGES = ROOT / "src" / "pages" # Product pages with FAQ UI (from earlier audit: lines >= 240 and grep -c FAQ > 0) TARGETS = [ "pipe-coupling.astro", "ท่อ-syler.astro", "หัวจ่าย-ball-jet.astro", "เม็กกรู๊ฟ-คับปลิ้ง.astro", "เครื่องเชื่อม-hdpe.astro", "เครื่องเชื่อม-ppr.astro", "เทอร์โมเบรค-thermobreak.astro", "realflex.astro", "water-treatment.astro", "วาล์ว-valve.astro", "รั้วเทวดา.astro", "ระบบรั้วไวน์แมน.astro", "durgo-avvs.astro", "ตู้ดับเพลิง.astro", "water-pump.astro", "grilles.astro", "ท่อ-upvc.astro", "armflex.astro", "aeroflex.astro", "maxflex.astro", ] def extract_faq(content: str) -> list[tuple[str, str]]: """Return list of (question, answer) tuples from FAQ section. Scopes regex to the FAQ section only: starts at "คำถามที่พบบ่อย" and ends at the next "