AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
feat(svg-to-pptx): extract conservative baseline layout families
hugohe31113feafc107
diff --git a/docs/roadmap.md b/docs/roadmap.mdindex 26f7b03a..b93d79a9 100644--- a/docs/roadmap.md+++ b/docs/roadmap.md@@ -82,7 +82,7 @@ The past two months' structural capability growth. Single flags / incremental po- **`--native-objects` hardened from dormant marker to usable opt-in** — the narrow native-object exception (see Non-goals below) now emits charts and pure-text tables that keep the deck's own design instead of snapping to PowerPoint's white default theme. Classic native charts write explicit chart-area / plot-area / axis-line / gridline / label-text colors — inferred from the visible SVG fallback (largest panel `<rect>` → background, fallback text → labels, fallback strokes → axis/grid) or overridden per `style` (`chart_area_fill` / `plot_area_fill` / `text_color` / `axis_color` / `grid_color`, `"none"` for transparent); the color parser normalizes named CSS colors, `#RGB` shorthand, and `rgb()` / `rgba()` to OOXML hex; bar/column series disable negative-value fill inversion so negative bars keep their series color. The activated export is named `<name>_<ts>_native_charts.pptx` to tell it apart from the default flattened-shape export. **The default route is unchanged** — charts/tables still export as SVG-derived DrawingML shapes for cross-renderer fidelity; native objects stay the deliberate opt-in trade documented under Non-goals below-- **Native package structure + conservative PPTX object round-trip** — native export keeps a real master/layout relationship and defaults to a baseline master that promotes only safe shared backgrounds/chrome. A locked `template` mode compiles declared SVG master/layout layers and typed placeholders without visual inference; a reusable PPTX imported through `create-template` retains its native pair as optional capability. Strategist now confirms template adherence: `strict` can lock `preserve`, retain the original master/layout/theme roster (including multiple masters), bind every page to an exact source layout, and restore source placeholder indices; `adaptive` keeps the created SVG roster optional and exports through baseline. Raw one-off PPTX filling remains the `template-fill-pptx` route. The standalone importer also emits fallback SVG plus native metadata for supported unmerged tables and classic-chart caches; unsupported semantics remain explicit fallback-only markers+- **Native package structure + conservative PPTX object round-trip** — native export keeps a real master/layout relationship and defaults to a baseline master that promotes only safe shared backgrounds/chrome. After SVG generation, baseline assigns filename-backed Cover/Agenda/Section/Closing/Content layouts and lifts only exact family-wide backgrounds; actual content remains slide-local and no placeholders are inferred. A locked `template` mode compiles declared SVG master/layout layers and typed placeholders without visual inference; a reusable PPTX imported through `create-template` retains its native pair as optional capability. Strategist now confirms template adherence: `strict` can lock `preserve`, retain the original master/layout/theme roster (including multiple masters), bind every page to an exact source layout, and restore source placeholder indices; `adaptive` keeps the created SVG roster optional and exports through baseline. Raw one-off PPTX filling remains the `template-fill-pptx` route. The standalone importer also emits fallback SVG plus native metadata for supported unmerged tables and classic-chart caches; unsupported semantics remain explicit fallback-only markers---diff --git a/docs/technical-design.md b/docs/technical-design.mdindex d21c8849..b83beefa 100644--- a/docs/technical-design.md+++ b/docs/technical-design.md@@ -427,7 +427,7 @@ These direct routes share some analysis primitives with the main pipeline, espec**Why compatibility fallback belongs to the SVG snapshot path, not native shapes.** Native PPTX export translates supported SVG elements into DrawingML shapes and explicitly disables PNG+SVG compatibility mode in native-shapes mode. The PNG fallback is used only by the legacy SVG-image path (`--svg-snapshot` / `--only legacy`) when a renderer is available, because that path embeds SVG media that older Office builds may not display. Legacy compatibility is therefore an optional snapshot deliverable, not a fallback bundled inside the primary editable native deck.-**Why the default native deck has a baseline master, not inferred templates.** `svg_to_pptx.py` keeps the actual blank slide layout relationship from the base package and defaults to `--pptx-structure baseline`. Baseline promotes only low-risk shared structure: the strict-majority identical slide background (every slide must carry an explicit background, and minority slides keep their own overriding fill), plus a common leading prefix of repeated top-level SVG chrome whose exact id tokens say `logo`, `footer`, `header`, `watermark`, `chrome`, `pageNumber`, or `slideNumber`. Chrome promotion also requires identical generated OOXML, no slide-timing reference, and the same leading z-order across a strict majority of slides sharing the master; overlay chrome stays slide-local. Minority slides — covers and section pages — keep every shape slide-local and are rebound to a generated `Cover` layout with `showMasterSp="0"`, following the PowerPoint convention that page-type differences live in layouts under one master rather than in extra masters, so promoted chrome never leaks onto them. Image relationships for promoted chrome are copied to the slide master, base-template slide layouts no generated slide references are pruned from the package, and `pageNumber`/`slideNumber` chrome whose text exactly equals the slide's display number (honoring `firstSlideNum`) becomes an auto-updating slide-number field so reordering slides in PowerPoint renumbers pages. This gives ordinary decks real master/layout structure without guessing reusable layouts or placeholders from visual similarity.+**Why the default native deck has a baseline master, not inferred templates.** `svg_to_pptx.py` keeps the actual blank slide layout relationship from the base package and defaults to `--pptx-structure baseline`. Baseline promotes only low-risk shared structure: the strict-majority identical slide background (every slide must carry an explicit background, and minority slides keep their own overriding fill), plus a common leading prefix of repeated top-level SVG chrome whose exact id tokens say `logo`, `footer`, `header`, `watermark`, `chrome`, `pageNumber`, or `slideNumber`. Chrome promotion also requires identical generated OOXML, no slide-timing reference, and the same leading z-order across a strict majority of slides sharing the master; overlay chrome stays slide-local. Minority slides — covers and section pages — keep every shape slide-local and are rebound to a generated `Cover` layout with `showMasterSp="0"`, following the PowerPoint convention that page-type differences live in layouts under one master rather than in extra masters, so promoted chrome never leaks onto them. After all pages are generated, an export-only pass assigns `Cover`, `Agenda`, `Section`, `Closing`, or fallback `Content` from exact filename role tokens. It preserves the current master-shape visibility, never compares page visuals or infers placeholders, and moves a family background to its Layout only when every family member carries the exact same explicit `p:bg`; actual page content remains on the Slide. Image relationships for promoted chrome are copied to the slide master, base-template slide layouts no generated slide references are pruned from the package, and `pageNumber`/`slideNumber` chrome whose text exactly equals the slide's display number (honoring `firstSlideNum`) becomes an auto-updating slide-number field so reordering slides in PowerPoint renumbers pages. This gives ordinary decks a useful master/layout roster without constraining SVG authoring or spending model context on layout planning.**Why reusable layouts require explicit SVG metadata.** `--pptx-structure template` is the opt-in path for a generated deck that must remain reusable as a PowerPoint template. The final slide SVGs declare a layout key at the root, mark only direct root children as master/layout layers, and attach typed placeholder semantics to the slide-local prototypes that should become layout placeholders. Export validates that shared master and same-key layout declarations are structurally and visually identical, then emits real layout parts and `p:ph` references while leaving every unmarked object slide-local. This is deterministic structure compilation, not visual-template inference.diff --git a/docs/zh/roadmap.md b/docs/zh/roadmap.mdindex 104b98c4..015081b4 100644--- a/docs/zh/roadmap.md+++ b/docs/zh/roadmap.md@@ -82,7 +82,7 @@- **`--native-objects` 从休眠 marker 硬化为可用级 opt-in** — 那条窄「原生对象」例外(见下文 Non-goals)现在导出的图表与纯文本表格会**保留 deck 自己的设计**,不再塌回 PowerPoint 的白底默认主题。classic 原生图表显式写入 chart-area / plot-area / 轴线 / 网格线 / 标签文字颜色——从可见的 SVG fallback 推断(最大面板型 `<rect>` → 背景、fallback 文字 → 标签、fallback 描边 → 轴线/网格),或用 `style` 显式覆盖(`chart_area_fill` / `plot_area_fill` / `text_color` / `axis_color` / `grid_color`,`"none"` 表透明);颜色解析把命名色、`#RGB` 简写、`rgb()` / `rgba()` 归一为 OOXML hex;bar/column 系列关掉负值反色,负值柱保持系列色。激活导出命名为 `<name>_<ts>_native_charts.pptx` 以与默认压平形状导出区分。**默认路线不变**——图表/表格仍以 SVG 派生的 DrawingML 形状导出以保跨渲染器保真;原生对象仍是下文 Non-goals 里那条刻意的 opt-in 取舍-- **原生 package 结构 + 保守 PPTX 对象回转** — 原生导出保留真实 master/layout 关系,默认 baseline 只提升安全的共享背景/chrome。锁定的 `template` 模式把显式 SVG master/layout layer 与有类型的 placeholder 编译成可复用版式,不做视觉推断;通过 `create-template` 导入的可复用 PPTX 会把原生结构对保留为可选能力。Strategist 进一步确认模板遵循方式:`strict` 可锁定 `preserve`,保留原 master/layout/theme 清单(包括多母版)、把每页绑定到精确源版式并恢复源 placeholder idx;`adaptive` 则把 SVG roster 作为可选参考并继续走 baseline。原始 PPTX 的一次性直接填充继续走 `template-fill-pptx`。导入器也会为受支持的未合并表格与 classic-chart cache 输出 fallback SVG 加原生元数据;无法等价表达的语义保持明确的 fallback-only marker+- **原生 package 结构 + 保守 PPTX 对象回转** — 原生导出保留真实 master/layout 关系,默认 baseline 只提升安全的共享背景/chrome。SVG 生成完成后,baseline 根据文件名中的明确角色分配 Cover/Agenda/Section/Closing/Content 版式,并且只提升家族内完全一致的背景;实际内容继续留在 Slide,不推断占位符。锁定的 `template` 模式把显式 SVG master/layout layer 与有类型的 placeholder 编译成可复用版式,不做视觉推断;通过 `create-template` 导入的可复用 PPTX 会把原生结构对保留为可选能力。Strategist 进一步确认模板遵循方式:`strict` 可锁定 `preserve`,保留原 master/layout/theme 清单(包括多母版)、把每页绑定到精确源版式并恢复源 placeholder idx;`adaptive` 则把 SVG roster 作为可选参考并继续走 baseline。原始 PPTX 的一次性直接填充继续走 `template-fill-pptx`。导入器也会为受支持的未合并表格与 classic-chart cache 输出 fallback SVG 加原生元数据;无法等价表达的语义保持明确的 fallback-only marker---diff --git a/docs/zh/technical-design.md b/docs/zh/technical-design.mdindex cee42356..7609730d 100644--- a/docs/zh/technical-design.md+++ b/docs/zh/technical-design.md@@ -427,7 +427,7 @@ PowerPoint 的 DrawingML 是 SVG 表达力的严格子集。Executor 在一份**为什么兼容 fallback 属于 SVG snapshot 路径,而不是 native shapes。** Native PPTX 导出会把受支持的 SVG 元素翻译成 DrawingML 形状,并在 native-shapes 模式下显式关闭 PNG+SVG 兼容模式。PNG fallback 只在 legacy SVG-image 路径(`--svg-snapshot` / `--only legacy`)且本地 renderer 可用时使用,因为那条路径嵌入的是旧版 Office 可能无法显示的 SVG media。因此,旧版兼容是一份可选 snapshot 交付物,不是捆在主 editable native deck 里的兜底层。-**为什么默认 native deck 使用基线母版,而不推断模板。** `svg_to_pptx.py` 会保留基础 package 中空白版式的真实关系,并默认使用 `--pptx-structure baseline`。Baseline 只提升低风险共享结构:严格多数页面完全一致的页面背景(每页都必须携带显式背景,少数派页面保留自己的背景并覆盖母版填充),以及位于 shape 序列开头(视觉后层)、且 id 精确 token 为 `logo`、`footer`、`header`、`watermark`、`chrome`、`pageNumber` 或 `slideNumber` 的重复 SVG chrome。Chrome 还必须在共享同一母版的严格多数页面上生成完全一致的 OOXML、没有被页面动画引用,并保持相同的前置 z-order;覆盖在正文之上的 chrome 继续留在 slide 本地。少数派页面(封面、章节页)的全部元素保持 slide-local,并被改绑到生成的 `Cover` 版式(`showMasterSp="0"`)——遵循 PowerPoint 的惯例:页型差异用同一母版下的版式表达而不是增加母版,因此被提升的母版 chrome 绝不会泄漏到这些页面上。被提升 chrome 的图片关系会复制到 slide master,基础模板中没有任何页面引用的 slide layout 也会从 package 中裁剪掉;`pageNumber`/`slideNumber` chrome 的文本若恰好等于该页应显示的页码(尊重 `firstSlideNum`),会转换为自动更新的 PowerPoint 页码字段,此后在 PowerPoint 中调整页序页码自动重算,其他编号方案保持字面文本不动。这样普通 deck 能获得真实的 master/layout 结构,同时不根据视觉相似度猜测可复用版式或占位符。+**为什么默认 native deck 使用基线母版,而不推断模板。** `svg_to_pptx.py` 会保留基础 package 中空白版式的真实关系,并默认使用 `--pptx-structure baseline`。Baseline 只提升低风险共享结构:严格多数页面完全一致的页面背景(每页都必须携带显式背景,少数派页面保留自己的背景并覆盖母版填充),以及位于 shape 序列开头(视觉后层)、且 id 精确 token 为 `logo`、`footer`、`header`、`watermark`、`chrome`、`pageNumber` 或 `slideNumber` 的重复 SVG chrome。Chrome 还必须在共享同一母版的严格多数页面上生成完全一致的 OOXML、没有被页面动画引用,并保持相同的前置 z-order;覆盖在正文之上的 chrome 继续留在 slide 本地。少数派页面(封面、章节页)的全部元素保持 slide-local,并被改绑到生成的 `Cover` 版式(`showMasterSp="0"`)——遵循 PowerPoint 的惯例:页型差异用同一母版下的版式表达而不是增加母版,因此被提升的母版 chrome 绝不会泄漏到这些页面上。全部页面生成完成后,导出器只根据文件名中的明确角色 token 分配 `Cover`、`Agenda`、`Section`、`Closing` 或兜底 `Content`;它保留当前版式的母版图形可见性,不比较页面视觉、不猜占位符,只有某一家族的每页都携带完全相同的显式 `p:bg` 时才把该背景提升到 Layout,实际页面内容始终留在 Slide。被提升 chrome 的图片关系会复制到 slide master,基础模板中没有任何页面引用的 slide layout 也会从 package 中裁剪掉;`pageNumber`/`slideNumber` chrome 的文本若恰好等于该页应显示的页码(尊重 `firstSlideNum`),会转换为自动更新的 PowerPoint 页码字段,此后在 PowerPoint 中调整页序页码自动重算,其他编号方案保持字面文本不动。这样普通 deck 能获得实用的 master/layout 清单,同时不限制 SVG 创作,也不消耗模型上下文预先规划版式。**为什么可复用版式必须依赖显式 SVG 元数据。** `--pptx-structure template` 是生成型 deck 需要继续作为 PowerPoint 模板复用时的 opt-in 路径。最终 slide SVG 在根节点声明 layout key,只允许根节点的直接子元素标记 master/layout layer,并在应成为版式占位框的 slide-local 原型上附加类型语义。导出器会验证共享 master 与同 key layout 的声明在结构和视觉上完全一致,再生成真实 layout part 与 `p:ph` 引用;所有未标记对象仍保持 slide-local。这是确定性的结构编译,不是根据视觉相似度猜模板。diff --git a/skills/ppt-master/SKILL.md b/skills/ppt-master/SKILL.mdindex d700c40b..e085218b 100644--- a/skills/ppt-master/SKILL.md+++ b/skills/ppt-master/SKILL.md@@ -695,9 +695,19 @@ python3 ${SKILL_DIR}/scripts/svg_to_pptx.py <project_path>> chrome stays slide-local. Minority slides (covers, section pages) keep every> shape slide-local and are bound to a generated `Cover` layout with> `showMasterSp="0"`, so promoted master chrome never appears on them. Image-> relationships for promoted chrome are copied to the master. Baseline also-> prunes base-template slide layouts no generated slide references, so the-> PowerPoint new-slide picker only offers layouts that belong to the deck, and+> relationships for promoted chrome are copied to the master. After the SVG+> pages are complete, baseline assigns conservative filename-backed layout+> families: explicit cover / agenda / section / closing names become `Cover`,+> `Agenda`, `Section`, and `Closing`; every other page becomes `Content`. It also+> preserves an existing safety `Cover` assignment made while hiding promoted+> Master chrome. It does not inspect visual similarity or infer placeholders,+> and all actual page content remains slide-local. When every slide in one+> family carries the exact same explicit background, that background moves to+> the family layout. This is+> an export-only package pass: SVG authoring, live preview, and model context are+> unchanged. Baseline also prunes base-template slide layouts no generated slide+> references, so the PowerPoint new-slide picker only offers layouts that belong+> to the deck, and> converts `pageNumber` / `slideNumber` chrome whose text exactly equals the> slide's display number into an auto-updating PowerPoint slide-number field> (other numbering schemes keep their literal text). For projects with adiff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.mdindex d9f39d52..91e4894a 100644--- a/skills/ppt-master/references/shared-standards.md+++ b/skills/ppt-master/references/shared-standards.md@@ -925,6 +925,31 @@ steal plot area in PPT. Add `show_legend: true` only when the legend is needed;**Forbidden — native marker transforms**: Do not rotate, skew, or matrix-transform native table/chart marker groups. Translate / scale is accepted; complex transforms fail export because PowerPoint native table/chart frames do not preserve arbitrary SVG transforms.+### Baseline Layout Family Extraction++Native `baseline` export assigns layout families after every SVG page has been+converted. This package-only pass does not change SVG authoring or live preview.++| Filename evidence | Output layout |+|---|---|+| `cover`, `frontcover`, `封面` | `Cover` |+| `agenda`, `contents`, `outline`, `toc`, `目录`, `议程` | `Agenda` |+| `chapter`, `divider`, `section`, `transition`, `章节`, `过渡页` | `Section` |+| `closing`, `end`, `ending`, `qa`, `thankyou`, `thanks`, `封底`, `结束`, `结尾`, `结语`, `致谢`, `谢谢` | `Closing` |+| No exact role token | `Content` |++Keep an existing `Cover` assignment when the Master chrome safety pass already+used it to hide promoted Master shapes from a minority page.++**Hard rule — no visual inference**: Keep every actual title, body, picture,+chart, table, and page-specific shape on the Slide. Baseline layouts do not+infer placeholders or promote visually similar content.++**Background rule**: Move a Slide `p:bg` to its family Layout only when every+slide in that family carries exactly the same explicit background. Otherwise,+keep each background on its Slide. Preserve whether each family shows or hides+the parent Master shape tree.+### Theme Font Inheritance (Baseline and Template Export)New projects derive PowerPoint theme fonts from `spec_lock.md` typography whendiff --git a/skills/ppt-master/scripts/docs/svg-pipeline.md b/skills/ppt-master/scripts/docs/svg-pipeline.mdindex 5ac98fd6..9b30c5c4 100644--- a/skills/ppt-master/scripts/docs/svg-pipeline.md+++ b/skills/ppt-master/scripts/docs/svg-pipeline.md@@ -62,7 +62,7 @@ Behavior:`svg_final/`. Use `-s` only as an explicit diagnostic override.- For PPTX template-import workspaces, use `-s svg-flat` when you need a visual round-trip check. The layered `svg/` tree is the machine-readable template source and intentionally does not inline inherited master / layout decoration into each slide.- Native mode is strict about unsupported visual SVG elements: if a visual element cannot be represented or safely preserved, export fails with the SVG file, element tag, and position instead of silently dropping content.-- Omitting `--pptx-structure` reads `spec_lock.md` `pptx_structure.mode`, then falls back to `baseline`; an explicit CLI value overrides the lock. Template mode builds reusable PowerPoint layouts only from explicit SVG metadata: root `data-pptx-layout`, direct-child `data-pptx-layer="master|layout"`, optional `data-pptx-layer="slide"` on a full-canvas solid background, and direct-child `data-pptx-placeholder`. It validates the per-page `pptx_layouts` lock plus cross-slide structure consistency and never infers layouts from visual similarity. Direct full-canvas solid rects compile to Master/Layout/Slide `p:bg` by scope; an unmarked one is a Slide override. Chart/table placeholders also require `--native-objects`. Full contract: [`shared-standards.md`](../../references/shared-standards.md#explicit-pptx-master--layout--placeholder-metadata-template-export).+- Omitting `--pptx-structure` reads `spec_lock.md` `pptx_structure.mode`, then falls back to `baseline`; an explicit CLI value overrides the lock. After SVG conversion, baseline assigns filename-backed `Cover` / `Agenda` / `Section` / `Closing` / `Content` layout families (while retaining an existing chrome-safety `Cover` assignment), keeps real page content slide-local, and moves a family background to Layout only when every member has the exact same explicit `p:bg`; it never infers placeholders or visual similarity. Template mode builds reusable PowerPoint layouts only from explicit SVG metadata: root `data-pptx-layout`, direct-child `data-pptx-layer="master|layout"`, optional `data-pptx-layer="slide"` on a full-canvas solid background, and direct-child `data-pptx-placeholder`. It validates the per-page `pptx_layouts` lock plus cross-slide structure consistency and never infers layouts from visual similarity. Direct full-canvas solid rects compile to Master/Layout/Slide `p:bg` by scope; an unmarked one is a Slide override. Chart/table placeholders also require `--native-objects`. Full contracts: [`shared-standards.md`](../../references/shared-standards.md#baseline-layout-family-extraction) and [`shared-standards.md`](../../references/shared-standards.md#explicit-pptx-master--layout--placeholder-metadata-template-export).- Template/preserve placeholder semantics distinguish title, subtitle, body, picture, chart, table, generic object, media, date, footer, and slide number. Reconstructed titles are normally type-matched without an index; explicit imported title indices and all other source indices are retained. Imported `subTitle`, `obj`, `media`, and `dt` identities remain distinct through `manifest.json`, `native_structure.json`, Layout XML, and Slide XML.- Baseline/template native export reads `spec_lock.md` typography into the PowerPoint theme: `title_family` becomes the major font and `body_family` / `font_family` becomes the minor font. Matching SVG text emits `+mj-*` / `+mn-*` tokens, while unrelated emphasis/code/brand families stay concrete. Preserve mode keeps the imported source theme; flat mode keeps fixed-font diagnostic output.- Baseline/template native export also maps canonical `spec_lock.md` color roles into the PowerPoint color scheme and emits context-safe `schemeClr` tokens for exact matches in SVG fills/text/strokes, gradients/patterns/bullets, native tables, and native-chart accent series. Local colors, inverse white/black, and effects stay concrete. Preserve mode keeps the imported source color scheme; flat mode keeps fixed-color diagnostic output.diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.pyindex bed8093f..030ac6e1 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/builder.py@@ -713,11 +713,13 @@ def _create_cover_layout(extract_dir: Path, master_part: str, base_layout_part:return posixpath.relpath(new_layout_part, "ppt/slides")-def _create_template_layout(+def _create_custom_layout(extract_dir: Path,master_part: str,base_layout_part: str,layout_name: str,+ *,+ show_master_shapes: bool = True,) -> tuple[str, str]:"""Clone a clean custom layout and register it under its slide master.@@ -728,7 +730,7 @@ def _create_template_layout(root = tree.getroot()root.set("type", "cust")root.set("preserve", "1")- root.set("showMasterSp", "1")+ root.set("showMasterSp", "1" if show_master_shapes else "0")c_sld = root.find(f"{{{PML_NS}}}cSld")if c_sld is None:@@ -816,6 +818,163 @@ def _set_slide_layout_target(rels_path: Path, target: str) -> None:rels_path.write_text(new_content, encoding="utf-8")+_BASELINE_LAYOUT_ROLE_TOKENS = (+ ("Cover", frozenset({"cover", "frontcover"}), ("封面",)),+ (+ "Agenda",+ frozenset({"agenda", "contents", "outline", "toc"}),+ ("目录", "议程"),+ ),+ (+ "Section",+ frozenset({"chapter", "divider", "section", "transition"}),+ ("章节", "过渡页"),+ ),+ (+ "Closing",+ frozenset({"closing", "end", "ending", "qa", "thankyou", "thanks"}),+ ("封底", "结束", "结尾", "结语", "致谢", "谢谢"),+ ),+)+++def _baseline_layout_role(svg_path: Path) -> str:+ """Classify only explicit filename roles; keep every other page as Content."""+ stem = svg_path.stem.casefold()+ tokens = {+ token+ for token in re.split(r"[^0-9a-z]+", stem)+ if token and not token.isdigit()+ }+ for role, english_tokens, cjk_tokens in _BASELINE_LAYOUT_ROLE_TOKENS:+ if tokens.intersection(english_tokens) or any(+ token in stem for token in cjk_tokens+ ):+ return role+ return "Content"+++def _layout_identity(layout_path: Path) -> tuple[str, bool]:+ """Return a layout's picker name and master-shape visibility."""+ root = ET.parse(layout_path).getroot()+ c_sld = root.find(f"{{{PML_NS}}}cSld")+ name = c_sld.attrib.get("name", "") if c_sld is not None else ""+ return name, root.attrib.get("showMasterSp", "1") != "0"+++def _shared_explicit_slide_background(+ extract_dir: Path,+ slide_nums: list[int],+) -> str | None:+ """Return one exact background only when every family slide carries it."""+ backgrounds: list[str] = []+ for slide_num in slide_nums:+ slide_path = extract_dir / "ppt" / "slides" / f"slide{slide_num}.xml"+ background = _extract_slide_background_xml(+ slide_path.read_text(encoding="utf-8")+ )+ if background is None:+ return None+ backgrounds.append(background)+ if not backgrounds or len(set(backgrounds)) != 1:+ return None+ return backgrounds[0]+++def _extract_baseline_layout_families(+ extract_dir: Path,+ structure: PptxStructureContext,+ svg_files: list[Path],+ *,+ verbose: bool = False,+) -> int:+ """Build conservative post-generation layout families for a free SVG deck."""+ families: dict[tuple[str, str, bool], list[int]] = {}+ base_layouts: dict[tuple[str, str, bool], str] = {}+ for slide_num, svg_path in enumerate(svg_files, 1):+ rels_path = (+ extract_dir+ / "ppt"+ / "slides"+ / "_rels"+ / f"slide{slide_num}.xml.rels"+ )+ layout_target = _find_relationship_target(rels_path, SLIDE_LAYOUT_REL_TYPE)+ if not layout_target:+ raise RuntimeError(f"Slide {slide_num} has no slide layout relationship")+ layout_part = _resolve_package_target(+ f"ppt/slides/slide{slide_num}.xml", layout_target+ )+ layout_name, show_master_shapes = _layout_identity(extract_dir / layout_part)+ role = _baseline_layout_role(svg_path)+ if role == "Content" and layout_name == COVER_LAYOUT_NAME:+ role = COVER_LAYOUT_NAME+ key = (+ structure.slide_master_part(slide_num),+ role,+ show_master_shapes,+ )+ families.setdefault(key, []).append(slide_num)+ base_layouts.setdefault(key, layout_part)++ created = 0+ lifted_backgrounds = 0+ role_counts: dict[tuple[str, str], int] = {}+ for key, slide_nums in families.items():+ master_part, role, show_master_shapes = key+ role_key = (master_part, role)+ role_counts[role_key] = role_counts.get(role_key, 0) + 1+ variant = role_counts[role_key]+ layout_name = role if variant == 1 else f"{role} {variant}"+ layout_target, layout_part = _create_custom_layout(+ extract_dir,+ master_part,+ base_layouts[key],+ layout_name,+ show_master_shapes=show_master_shapes,+ )++ background_xml = _shared_explicit_slide_background(+ extract_dir, slide_nums+ )+ if background_xml is not None:+ layout_path = extract_dir / layout_part+ layout_xml = layout_path.read_text(encoding="utf-8")+ updated_layout_xml = _put_background_on_part(layout_xml, background_xml)+ if updated_layout_xml is not None:+ layout_path.write_text(updated_layout_xml, encoding="utf-8")+ for slide_num in slide_nums:+ slide_path = (+ extract_dir / "ppt" / "slides" / f"slide{slide_num}.xml"+ )+ slide_path.write_text(+ _remove_slide_background_xml(+ slide_path.read_text(encoding="utf-8")+ ),+ encoding="utf-8",+ )+ lifted_backgrounds += len(slide_nums)++ for slide_num in slide_nums:+ rels_path = (+ extract_dir+ / "ppt"+ / "slides"+ / "_rels"+ / f"slide{slide_num}.xml.rels"+ )+ _set_slide_layout_target(rels_path, layout_target)+ created += 1++ if verbose and created:+ print(+ " Baseline layout families: "+ f"created {created} reusable layout(s), "+ f"lifted {lifted_backgrounds} slide background(s)"+ )+ return created++_TEMPLATE_PLACEHOLDER_TYPES = {"title": "title","subtitle": "subTitle",@@ -1605,7 +1764,7 @@ def _apply_template_structure(f"ppt/slides/slide{prototype.slide_num}.xml",base_target,)- layout_target, layout_part = _create_template_layout(+ layout_target, layout_part = _create_custom_layout(extract_dir,master_part,base_layout_part,@@ -2948,7 +3107,8 @@ def create_pptx_with_native_svg(markers to native PowerPoint objects. Default off.conversion_trace_path: Optional JSON path for native conversion diagnostics.pptx_structure: PPTX structure strategy. ``baseline`` promotes safe- shared native backgrounds and leading chrome to slide masters;+ shared native backgrounds and leading chrome to slide masters,+ then extracts conservative filename-backed layout families;``template`` consumes explicit SVG master/layout/placeholdermetadata; ``preserve`` reuses an imported source PPTX package;``flat`` keeps generated structure slide-local.@@ -3528,6 +3688,12 @@ def create_pptx_with_native_svg(conversion_trace if conversion_trace is not None else structure_trace,verbose=verbose,)+ _extract_baseline_layout_families(+ extract_dir,+ structure,+ svg_files,+ verbose=verbose,+ )_prune_unused_slide_layouts(extract_dir,structure,diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.pyindex 35ec1ed4..436e7a4e 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/cli.py@@ -229,7 +229,8 @@ Recorded narration:help=('PPTX structure strategy for native export. When omitted, read ''spec_lock.md pptx_structure.mode, falling back to baseline. baseline '- 'promotes safe repeated background/chrome; template consumes explicit '+ 'promotes safe repeated background/chrome and extracts conservative '+ 'filename-backed layout families; template consumes explicit ''data-pptx-layout/layer/placeholder metadata to build reusable layouts; ''preserve binds generated slides to an imported source template package; ''flat leaves generated structure slide-local for debugging/comparison.'diff --git a/skills/ppt-master/templates/spec_lock_reference.md b/skills/ppt-master/templates/spec_lock_reference.mdindex fa5c4b27..cb26a3b9 100644--- a/skills/ppt-master/templates/spec_lock_reference.md+++ b/skills/ppt-master/templates/spec_lock_reference.md@@ -134,7 +134,7 @@> ```> Omit the row for free design and brand-only templates. `adaptive` treats template SVGs as optional page references and always exports through `baseline`; `strict` requires one `page_layouts` row per page and may use `preserve` when the template carries a compatible native pair.>-> - `baseline` — default. Preserve the conservative shared Master/background/chrome behavior; no explicit reusable placeholder layouts are authored.+> - `baseline` — default. Preserve conservative shared Master/background/chrome behavior, then assign filename-backed Cover/Agenda/Section/Closing/Content layouts after SVG generation. Actual content stays slide-local; no reusable placeholders or visual-similarity inference are authored.> - `template` — use only when the user explicitly requests a reusable PowerPoint template/master/layout deliverable. Requires a complete `pptx_layouts` section and explicit SVG structure metadata on every generated page.> - `preserve` — use only with `template_adherence: strict` when the selected reusable template ships `native_structure.json` + `source_template.pptx`. Add both project-relative rows below and map every page under `pptx_layouts`. `adaptive + preserve` is invalid.> - `flat` — diagnostic escape hatch. Do not lock this in a normal project; pass it on the CLI when comparing slide-local output.