From ec60b77a7136a1281e94d36e86bff7d825c8c089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=A3=E5=AE=8F=E5=87=AF?= Date: Wed, 24 Jun 2026 11:09:48 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1):=20?= =?UTF-8?q?=E5=BF=85=E9=A1=BB=E7=94=9F=E6=88=90HTML=E7=9A=84=E3=80=8C?= =?UTF-8?q?=E5=8F=82=E8=80=83=E6=94=B6=E8=97=8F=E9=A1=B5=E9=9D=A2=E3=80=8D?= =?UTF-8?q?=E5=8A=A0=E5=85=A5=20no.1/no.2=20=E6=A8=A1=E6=9D=BF=E4=BD=9C?= =?UTF-8?q?=E4=B8=BA=E9=A3=8E=E6=A0=BC=E5=8F=82=E8=80=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 引擎 template_fill.style_reference:抽取模板 ", re.DOTALL | re.IGNORECASE) +_SCRIPT_BLOCK_RE = re.compile(r"]*>.*?", re.DOTALL | re.IGNORECASE) +_BODY_RE = re.compile(r"]*>(.*?)", re.DOTALL | re.IGNORECASE) + + +def reference_template_id(reference: str | None) -> str | None: + """``tpl:no1`` → ``no1``;非模板参考(普通收藏 id / 空)返回 None。""" + if isinstance(reference, str) and reference.startswith(REFERENCE_PREFIX): + return reference[len(REFERENCE_PREFIX) :] or None + return None + + +def style_reference(template_id: str, *, max_style: int = 24000, max_layout: int = 6000) -> dict[str, str]: + """抽取模板的紧凑「风格/版式参考」(``