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
fix(pptx-to-svg): honor inherited shape visibility
hugohe3f6d2f6e90600
diff --git a/docs/powerpoint-svg-mapping.md b/docs/powerpoint-svg-mapping.mdindex b51947da..b16a6b1d 100644--- a/docs/powerpoint-svg-mapping.md+++ b/docs/powerpoint-svg-mapping.md@@ -56,6 +56,7 @@ See [`canvas-formats.md`](../skills/ppt-master/references/canvas-formats.md) for| Template-backed deck structure | `pptx_structure.mode: structured` plus explicit Master/Layout/page assignments | Declared `p:sldMaster`, `p:sldLayout`, registrations, and slide parentage | `Native-stable` within the explicit structure contract | The exporter never guesses a Master, Layout, or placeholder topology || Slide Master | Root Master identity plus atomic `data-pptx-layer="master"` objects; one validated compact authored-preset `<g>` counts as one semantic atom | Reusable Master part and picker identity | Source structure is restored by template/import workflows | Master atoms must be direct, stable, and identical across their slides; ordinary or expanded authored groups do not qualify || Slide Layout | Root Layout identity plus atomic `data-pptx-layer="layout"` objects; one validated compact authored-preset `<g>` counts as one semantic atom | Reusable Layout part under one Master | Source Layouts can be restored; adaptive authoring may allocate a new Layout | Reuse a Layout key only when its fixed atoms and slot contract are identical; ordinary or expanded authored groups do not qualify |+| Imported inherited-shape visibility | PPTX `p:sld@showMasterSp` and `p:sldLayout@showMasterSp`; layered analysis records normalized source booleans outside visible SVG | No new generated-authoring marker; source-preserving workflows retain the package fields | `Native-stable` for imported visual/analysis facts: Slide false hides Layout and Master shapes; Layout false hides only Master shapes | Backgrounds, Slide-local objects, placeholder inheritance, part SVGs, and parent relationships remain intact; flat import omits only the suppressed inherited shapes || Strict template Layout | Selected prototype contract | Existing declared Layout topology is preserved | `Native-stable` when the page follows the prototype | Fixed Layout atoms and slot structure may not change || Adaptive template Layout | Selected Master plus an explicit current or newly declared Layout | A new Layout identity may be created when reusable structure changes | `Native-stable` after the lock and page mapping are updated | Never mutate a reused Layout key silently || Slide background fill outside structured mode | First eligible full-canvas `<rect>`, direct or in a simple single-child group, with a registered solid, linear/radial gradient, or preset-pattern fill | Native slide `p:bg` | Fidelity follows the corresponding paint row below | Transform, filter, clip, rounding, visible stroke, or an unmapped fill prevents promotion |diff --git a/docs/zh/powerpoint-svg-mapping.md b/docs/zh/powerpoint-svg-mapping.mdindex f3278345..7f37656b 100644--- a/docs/zh/powerpoint-svg-mapping.md+++ b/docs/zh/powerpoint-svg-mapping.md@@ -56,6 +56,7 @@ PowerPoint 意图| 基于模板的演示文稿结构 | `pptx_structure.mode: structured` 加显式 Master/Layout/页面分配 | 声明的 `p:sldMaster`、`p:sldLayout`、注册与 Slide 父子关系 | 在显式结构合同内为 `Native-stable` | 导出器绝不猜测 Master、Layout 或占位符拓扑 || 幻灯片母版 | 根 Master 身份加原子级 `data-pptx-layer="master"` 对象;一个校验通过的 compact authored-preset `<g>` 计为一个 semantic atom | 可复用 Master part 与 picker 身份 | 源结构由模板/导入工作流恢复 | Master atom 必须为直接、稳定对象,并在所属页面间一致;普通组或 expanded authored 组不具备该资格 || 幻灯片版式 | 根 Layout 身份加原子级 `data-pptx-layer="layout"` 对象;一个校验通过的 compact authored-preset `<g>` 计为一个 semantic atom | 某个 Master 下的可复用 Layout part | 可恢复源 Layout;adaptive 创作可分配新 Layout | 仅当固定 atom 和 slot 合同完全相同时才复用 Layout key;普通组或 expanded authored 组不具备该资格 |+| 回导的继承图形可见性 | PPTX 的 `p:sld@showMasterSp` 与 `p:sldLayout@showMasterSp`;分层分析在可见 SVG 之外记录规范化的源布尔值 | 不新增生成侧创作 marker;源保留工作流保留包字段 | 对回导视觉与分析事实为 `Native-stable`:Slide 为 false 时隐藏 Layout 与 Master 图形;Layout 为 false 时只隐藏 Master 图形 | 背景、Slide-local 对象、占位符继承、独立 part SVG 与父子关系保持不变;flat 回导只省略被抑制的继承图形 || strict 模板 Layout | 选中的原型合同 | 保留现有已声明 Layout 拓扑 | 页面遵循原型时为 `Native-stable` | 不得改变固定 Layout atom 和 slot 结构 || adaptive 模板 Layout | 选定 Master 加显式的当前或新声明 Layout | 可在可复用结构变化时创建新 Layout 身份 | 更新 lock 与页面映射后为 `Native-stable` | 绝不默默改变已复用 Layout key || structured 模式以外的 Slide 背景填充 | 第一个合格的全幅 `<rect>`,可直接位于根下或位于简单单子组中,使用已登记纯色、线性/径向渐变或预设图案填充 | Slide 的原生 `p:bg` | 保真度遵循下文对应 paint 行 | transform、filter、clip、圆角、可见 stroke 或未映射 fill 会阻止提升 |diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.mdindex 36a08c6a..3bb6ec7f 100644--- a/skills/ppt-master/references/shared-standards.md+++ b/skills/ppt-master/references/shared-standards.md@@ -1746,6 +1746,20 @@ Every new SVG project declares one deterministic route. Free-design and brand-on**Template behavior**: Strict preserves the selected prototype's declared Master/Layout/slot contract. Adaptive retains its Master and may allocate a new Layout key/name only when fixed Layout atoms or slot topology/bounds change; update the lock during authoring. Mirror-created prototypes preserve restored source identity, literal paint, typography, effects, atomic geometry, and referenced assets. `standard` / `fidelity` never make source topology authoritative; mirror does not synthesize a replacement topology.+**Imported inherited-shape visibility**: PPTX import reads+`p:sld@showMasterSp` and `p:sldLayout@showMasterSp` as XML Schema booleans;+an absent value, `1`, or `true` enables the relevant inherited shapes, while+`0` or `false` disables them. A disabled Slide value suppresses both Layout+and Master drawable shapes on that page. A disabled Layout value suppresses+only its parent Master's drawable shapes; the Layout's own shapes remain.+Neither flag changes background inheritance, Slide-local objects,+placeholder geometry/style inheritance, or the Master/Layout relationship+graph. Flat SVG import bakes the effective visibility. Layered import keeps+every standalone part SVG and records the source-owned booleans as+`slides[].showInheritedShapes` and `layouts[].showMasterShapes` in+`inheritance.json`, `manifest.json`, and `native_structure.json`. This is an+import/analysis fact; it does not introduce a generated-authoring SVG marker.+**Master text-style contract**: Flat and structured export map thelocked `title` size to every `a:defRPr` in Master `p:titleStyle`. Level 1 inboth `p:bodyStyle` and `p:otherStyle` uses the locked `body` size; levels 2–9diff --git a/skills/ppt-master/scripts/docs/project.md b/skills/ppt-master/scripts/docs/project.mdindex 1fe40590..e39af7f8 100644--- a/skills/ppt-master/scripts/docs/project.md+++ b/skills/ppt-master/scripts/docs/project.md@@ -108,8 +108,8 @@ Notes:- Resolves slide / layout / master relationships from OOXML relationships; every master and layout is included even when no sample slide currently references it- Generates `manifest.json` (single source of truth for slide size, theme, per-master themes, assets, layouts, masters, placeholders, slides, SVG file paths, and page-type candidates), `summary.md` (short orientation digest), `assets/`, and shape-level SVGs under `svg/`- **SVG output emits two views by default** (`--inheritance-mode both`):- - `svg/` — layered template view for designers: every master and layout in the deck rendered once as `svg/master_*.svg` / `svg/layout_*.svg` (including ones no sample slide currently references); `svg/slide_NN.svg` contains only that slide's own shapes; `svg/inheritance.json` records which layout / master each slide consumes.- - `svg-flat/` — companion view: each `slide_NN.svg` is self-contained (master + layout + slide painted into one file), so opening any slide in isolation shows the full page like PowerPoint would. Useful for previews, screenshots, and "did this slide actually render correctly" sanity checks.+ - `svg/` — layered template view for designers: every master and layout in the deck rendered once as `svg/master_*.svg` / `svg/layout_*.svg` (including ones no sample slide currently references); `svg/slide_NN.svg` contains only that slide's own shapes; `svg/inheritance.json` records parentage plus source-owned `showInheritedShapes` / `showMasterShapes` booleans.+ - `svg-flat/` — companion view: each `slide_NN.svg` is self-contained (the effective visible Master/Layout contributions plus Slide-local content painted into one file), so opening any slide in isolation shows the full page like PowerPoint would. Background inheritance remains independent of inherited-shape visibility. Useful for previews, screenshots, and "did this slide actually render correctly" sanity checks.- `manifest.json` records `svgFile` for slides / layouts / masters, `flatSvgFile` for slides when `svg-flat/` exists, placeholder type / index / geometry / base style, an asset map used by SVG `href` values, and common assets reused through slide / layout / master inheritance. Placeholder semantics keep `subTitle`, `obj`, `media`, and `dt` distinct as `subtitle`, `object`, `media`, and `date`.- Layered slide SVGs keep only the slide's own background; inherited master / layout backgrounds stay in the corresponding master / layout SVGs- Placeholder guides are intentionally lightweight in `svg/` master / layout files; `svg-flat/` hides those guides and is the visual preview sourcediff --git a/skills/ppt-master/scripts/pptx_to_svg/converter.py b/skills/ppt-master/scripts/pptx_to_svg/converter.pyindex 9045eed4..0b7950e6 100644--- a/skills/ppt-master/scripts/pptx_to_svg/converter.py+++ b/skills/ppt-master/scripts/pptx_to_svg/converter.py@@ -20,7 +20,12 @@ from pathlib import Path, PurePosixPathfrom .color_resolver import ColorPalettefrom .emu_units import NS-from .ooxml_loader import OoxmlPackage, PartRef, SlideRef+from .ooxml_loader import (+ OoxmlPackage,+ PartRef,+ SlideRef,+ part_show_master_sp,+)from .slide_to_svg import assemble_part_solo, assemble_slide@@ -82,9 +87,9 @@ class ConvertOptions:renders every master and layout to its own SVG, plussvg/inheritance.json describing the reuse graph. Optimised fortemplate authors who need to see "what is shared vs. unique".- - "flat": inline inherited shapes into every slide. Used by- svg_to_pptx round-trip and any caller that wants self-contained- slides (preview pages, screenshot pipelines).+ - "flat": inline the inherited shapes visible under the source+ ``showMasterSp`` flags. Used by svg_to_pptx round-trip and any caller+ that wants self-contained slides (preview pages, screenshot pipelines)."""media_subdir: str = "assets"@@ -105,6 +110,7 @@ class PartArtifact:media_files: dict[str, bytes] = field(default_factory=dict)parent_master_part_path: str | None = Nonetheme_part_path: str | None = None+ show_master_shapes: bool = True@dataclass@@ -116,6 +122,7 @@ class SlideArtifact:media_files: dict[str, bytes] = field(default_factory=dict)layout_part_path: str | None = Nonemaster_part_path: str | None = None+ show_inherited_shapes: bool = True@dataclass@@ -244,6 +251,7 @@ def _convert_slide(mode = inheritance_mode or options.inheritance_modeif mode == "both":mode = "layered" # primary view in both-mode+ show_inherited_shapes = part_show_master_sp(slide.part)svg, media = assemble_slide(pkg, slide, palette,theme_fonts=theme_fonts,@@ -259,6 +267,7 @@ def _convert_slide(media_files=media,layout_part_path=slide.layout.path if slide.layout else None,master_part_path=slide.master.path if slide.master else None,+ show_inherited_shapes=show_inherited_shapes,)@@ -343,6 +352,9 @@ def _render_part(media_files=media,parent_master_part_path=parent_master.path if parent_master is not None else None,theme_part_path=theme_part.path if theme_part is not None else None,+ show_master_shapes=(+ part_show_master_sp(part) if role == "layout" else True+ ),)@@ -404,7 +416,7 @@ def _write_artifacts(output_dir: Path, result: ConvertResult,def _write_inheritance_json(svg_dir: Path, result: ConvertResult) -> None:- """Record which layout/master each slide consumes (layered mode only)."""+ """Record layered parentage plus source-owned shape-visibility booleans."""layout_by_path = {art.part_path: art.filename for art in result.layouts}master_by_path = {art.part_path: art.filename for art in result.masters}@@ -424,6 +436,7 @@ def _write_inheritance_json(svg_dir: Path, result: ConvertResult) -> None:"master": master_by_path.get(art.parent_master_part_path or ""),"parentPartPath": art.parent_master_part_path,"themePath": art.theme_part_path,+ "showMasterShapes": art.show_master_shapes,}for art in result.layouts],@@ -433,6 +446,7 @@ def _write_inheritance_json(svg_dir: Path, result: ConvertResult) -> None:"index": slide.index,"layout": layout_by_path.get(slide.layout_part_path or ""),"master": master_by_path.get(slide.master_part_path or ""),+ "showInheritedShapes": slide.show_inherited_shapes,}for slide in result.slides],diff --git a/skills/ppt-master/scripts/pptx_to_svg/ooxml_loader.py b/skills/ppt-master/scripts/pptx_to_svg/ooxml_loader.pyindex 4a9ae1f0..ae8d986c 100644--- a/skills/ppt-master/scripts/pptx_to_svg/ooxml_loader.py+++ b/skills/ppt-master/scripts/pptx_to_svg/ooxml_loader.py@@ -119,6 +119,53 @@ class SlideRef:master: PartRef | None+def parse_ooxml_boolean(+ raw: str | None,+ *,+ default: bool,+ context: str,+) -> bool:+ """Parse one XML Schema boolean without silently accepting bad OOXML."""+ if raw is None:+ return default+ token = raw.strip()+ if token in {"1", "true"}:+ return True+ if token in {"0", "false"}:+ return False+ raise RuntimeError(f"{context}: invalid boolean value {raw!r}")+++def part_show_master_sp(part: PartRef) -> bool:+ """Return one slide/layout part's raw ``showMasterSp`` semantic value."""+ return parse_ooxml_boolean(+ part.xml.attrib.get("showMasterSp"),+ default=True,+ context=f"{part.path} showMasterSp",+ )+++def inherited_shape_visibility(slide: SlideRef) -> tuple[bool, bool]:+ """Return effective ``(layout_shapes, master_shapes)`` visibility.++ A slide-level false value suppresses both inherited shape trees. A+ layout-level false value suppresses only its parent Master's shape tree.+ Background inheritance is separate and intentionally not represented by+ these booleans.+ """+ show_layout_shapes = part_show_master_sp(slide.part)+ layout_shows_master_shapes = (+ part_show_master_sp(slide.layout)+ if slide.layout is not None else True+ )+ show_master_shapes = (+ show_layout_shapes+ and slide.master is not None+ and layout_shows_master_shapes+ )+ return show_layout_shapes, show_master_shapes++# ---------------------------------------------------------------------------# OoxmlPackage# ---------------------------------------------------------------------------diff --git a/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.pyindex 587f4922..95708c3c 100644--- a/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py@@ -43,7 +43,12 @@ from .effect_to_svg import convert_effectsfrom .emu_units import NS, Xfrm, fmt_num, format_canvas_px_from_emufrom .fill_to_svg import resolve_fillfrom .ln_to_svg import resolve_stroke-from .ooxml_loader import OoxmlPackage, PartRef, SlideRef+from .ooxml_loader import (+ OoxmlPackage,+ PartRef,+ SlideRef,+ inherited_shape_visibility,+)from .pic_to_svg import convert_blip_fill, convert_picturefrom .prstgeom_to_svg import GeomResult, convert_prst_geomfrom .preset_svg_markup import serialize_preset_layers@@ -112,9 +117,10 @@ def assemble_slide("""Convert one slide to a complete SVG string + media files map.inheritance_mode controls how master/layout shapes are rendered:- - "flat" (default): emit master + layout non-placeholder shapes inline- inside the slide SVG. This is the historical behavior, used for- round-trip fidelity with svg_to_pptx.+ - "flat" (default): emit the effective visible Master/Layout+ non-placeholder shapes inline inside the slide SVG, honoring both+ source ``showMasterSp`` flags. This view is used for round-trip+ fidelity with svg_to_pptx.- "layered": skip inherited shapes entirely. The slide SVG containsonly its own shapes. Callers (e.g. /create-template's PPTX import)render master/layout once each as separate SVGs and record the@@ -1083,8 +1089,13 @@ def _theme_background_fill(def _emit_inherited_shapes(slide: SlideRef, ctx: AssemblyContext) -> list[str]:parts: list[str] = []- for prefix, part in (("master-", slide.master), ("layout-", slide.layout)):- if part is None:+ show_layout_shapes, show_master_shapes = inherited_shape_visibility(slide)+ inherited_parts = (+ ("master-", slide.master, show_master_shapes),+ ("layout-", slide.layout, show_layout_shapes),+ )+ for prefix, part, visible in inherited_parts:+ if part is None or not visible:continueoriginal_part = ctx.slide_partoriginal_prefix = ctx.group_id_prefixdiff --git a/skills/ppt-master/scripts/template_import/manifest.py b/skills/ppt-master/scripts/template_import/manifest.pyindex 4c1e3340..f34f78a8 100644--- a/skills/ppt-master/scripts/template_import/manifest.py+++ b/skills/ppt-master/scripts/template_import/manifest.py@@ -31,6 +31,8 @@ from pathlib import Path, PurePosixPathfrom typing import Anyfrom xml.etree import ElementTree as ET+from pptx_to_svg.ooxml_loader import parse_ooxml_boolean+NS = {"a": "http://schemas.openxmlformats.org/drawingml/2006/main",@@ -59,6 +61,7 @@ class SlideRecord:slide_path: strlayout_path: str | Nonemaster_path: str | None+ show_inherited_shapes: boolbackground_asset: str | Nonebackground_source: str | Noneimage_assets: list[str]@@ -88,9 +91,11 @@ def summarize_part_record(bg_asset = detect_background_asset(root, rels)image_targets = extract_image_targets(root, rels)+ sp_tree = root.find("p:cSld/p:spTree", NS) if root is not None else None+ shape_image_targets = extract_image_targets(sp_tree, rels)display_name = part_display_name(root, part_path)layout_type = root.attrib.get("type") if root is not None else None- return {+ record = {"path": part_path,"name": PurePosixPath(part_path).name,"displayName": display_name,@@ -101,6 +106,10 @@ def summarize_part_record("theme": theme,"backgroundAsset": copied_assets.get(bg_asset, PurePosixPath(bg_asset).name if bg_asset else None),"imageAssets": [copied_assets.get(target, PurePosixPath(target).name) for target in image_targets],+ "shapeImageAssets": [+ copied_assets.get(target, PurePosixPath(target).name)+ for target in shape_image_targets+ ],"placeholders": extract_placeholders(root),"textSamples": extract_text_samples(root),"textCount": len(root.findall(".//a:t", NS)) if root is not None else 0,@@ -108,6 +117,13 @@ def summarize_part_record("drawableShapeCount": count_drawable_shapes(root),"usedBySlides": used_by_slides,}+ if root is not None and root.tag == f"{{{NS['p']}}}sldLayout":+ record["showMasterShapes"] = parse_ooxml_boolean(+ root.attrib.get("showMasterSp"),+ default=True,+ context=f"{part_path} showMasterSp",+ )+ return recorddef normalize_part(path: str, base: str | None = None) -> str:@@ -447,6 +463,38 @@ def choose_common_assets(asset_usage: Counter[str]) -> list[str]:return sorted(common)+def _effective_inherited_image_assets(+ *,+ show_inherited_shapes: bool,+ layout_record: dict[str, Any] | None,+ master_record: dict[str, Any] | None,+) -> set[str]:+ """Return visible inherited shape images, excluding background assets."""+ if not show_inherited_shapes:+ return set()++ def shape_images(record: dict[str, Any] | None) -> set[str]:+ if record is None:+ return set()+ if "shapeImageAssets" in record:+ return {+ asset+ for asset in record.get("shapeImageAssets", [])+ if asset+ }+ background = record.get("backgroundAsset")+ return {+ asset+ for asset in record.get("imageAssets", [])+ if asset and asset != background+ }++ assets = shape_images(layout_record)+ if layout_record is None or layout_record.get("showMasterShapes", True):+ assets.update(shape_images(master_record))+ return assets++def write_summary(output_path: Path, manifest: dict[str, Any]) -> None:"""Render a short human digest derived from manifest.json.@@ -687,6 +735,12 @@ def build_manifest(pptx_path: Path, output_dir: Path) -> dict[str, Any]:slide_path=slide_path,layout_path=layout_path,master_path=master_path,+ show_inherited_shapes=parse_ooxml_boolean(+ slide_root.attrib.get("showMasterSp")+ if slide_root is not None else None,+ default=True,+ context=f"{slide_path} showMasterSp",+ ),background_asset=resolved_bg,background_source=bg_source,image_assets=resolved_images,@@ -763,15 +817,12 @@ def build_manifest(pptx_path: Path, output_dir: Path) -> dict[str, Any]:if slide.background_asset:per_slide_assets.add(slide.background_asset)layout_record = layout_by_path.get(slide.layout_path or "")- if layout_record:- if layout_record.get("backgroundAsset"):- per_slide_assets.add(layout_record["backgroundAsset"])- per_slide_assets.update(layout_record.get("imageAssets", []))master_record = master_by_path.get(slide.master_path or "")- if master_record:- if master_record.get("backgroundAsset"):- per_slide_assets.add(master_record["backgroundAsset"])- per_slide_assets.update(master_record.get("imageAssets", []))+ per_slide_assets.update(_effective_inherited_image_assets(+ show_inherited_shapes=slide.show_inherited_shapes,+ layout_record=layout_record,+ master_record=master_record,+ ))for asset in per_slide_assets:if asset:asset_usage[asset] += 1@@ -805,6 +856,7 @@ def build_manifest(pptx_path: Path, output_dir: Path) -> dict[str, Any]:"slidePath": slide.slide_path,"layoutPath": slide.layout_path,"masterPath": slide.master_path,+ "showInheritedShapes": slide.show_inherited_shapes,"backgroundAsset": slide.background_asset,"backgroundSource": slide.background_source,"imageAssets": slide.image_assets,diff --git a/skills/ppt-master/scripts/template_import/native_structure.py b/skills/ppt-master/scripts/template_import/native_structure.pyindex aea0a290..0ca85605 100644--- a/skills/ppt-master/scripts/template_import/native_structure.py+++ b/skills/ppt-master/scripts/template_import/native_structure.py@@ -120,6 +120,7 @@ def build_native_structure("theme": master.get("theme") or {"colors": {}, "fonts": {}},"backgroundAsset": master.get("backgroundAsset"),"imageAssets": master.get("imageAssets", []),+ "shapeImageAssets": master.get("shapeImageAssets", []),"drawableShapeCount": master.get("drawableShapeCount", 0),"layoutKeys": [layout_key_by_path[layout["path"]]@@ -137,8 +138,10 @@ def build_native_structure("type": layout.get("layoutType"),"packagePart": layout["path"],"masterKey": master_key_by_path.get(layout.get("parentPath")),+ "showMasterShapes": layout.get("showMasterShapes", True),"backgroundAsset": layout.get("backgroundAsset"),"imageAssets": layout.get("imageAssets", []),+ "shapeImageAssets": layout.get("shapeImageAssets", []),"drawableShapeCount": layout.get("drawableShapeCount", 0),"placeholders": layout.get("placeholders", []),"usedBySlides": layout.get("usedBySlides", []),@@ -152,6 +155,7 @@ def build_native_structure("pageType": slide.get("pageType"),"layoutKey": layout_key_by_path.get(slide.get("layoutPath")),"masterKey": master_key_by_path.get(slide.get("masterPath")),+ "showInheritedShapes": slide.get("showInheritedShapes", True),"placeholders": slide.get("placeholders", []),"layeredSvgFile": slide.get("svgFile"),"flatSvgFile": slide.get("flatSvgFile"),diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.pyindex 0b3bdb13..6bb4c619 100644--- a/skills/ppt-master/scripts/test_svg_quality_checker.py+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py@@ -36,6 +36,7 @@ from pptx_to_svg.preset_authoring import ()from pptx_to_svg.emu_units import Xfrmfrom pptx_to_svg.converter import ConvertOptions, convert_pptx_to_svg+from pptx_to_svg.ooxml_loader import parse_ooxml_booleanfrom pptx_to_svg.txbody_to_svg import convert_txbody, convert_vertical_txbodyfrom svg_to_pptx.animation_config import (build_group_listing,@@ -76,6 +77,11 @@ from svg_to_pptx.pptx_package.template_structure import ()from svg_to_pptx.use_expander import UseExpansionError, expand_local_use_referencesfrom template_preview_pptx import _canvas_viewbox as preview_canvas_viewbox+from template_import.manifest import (+ _effective_inherited_image_assets,+ build_manifest,+)+from template_import.native_structure import build_native_structureclass SVGQualityCheckerCompatibilityTests(unittest.TestCase):@@ -111,6 +117,91 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):svg_path.write_text(content, encoding='utf-8')return SVGQualityChecker().check_file(str(svg_path))+ @staticmethod+ def _write_show_master_fixture(+ path: Path,+ *,+ slide_values: list[str | None],+ layout_value: str | None = None,+ ) -> None:+ """Write a real PPTX with distinct Master/Layout/Slide contributions."""+ presentation = Presentation()+ layout = presentation.slide_layouts[0]+ for index, _value in enumerate(slide_values, start=1):+ slide = presentation.slides.add_slide(layout)+ slide.shapes.title.text = f'SLIDE LOCAL {index}'+ presentation.save(path)++ pml = 'http://schemas.openxmlformats.org/presentationml/2006/main'+ dml = 'http://schemas.openxmlformats.org/drawingml/2006/main'++ def inherited_shape(name: str, color: str, shape_id: int, x: int) -> ET.Element:+ return ET.fromstring(f'''<p:sp xmlns:p="{pml}" xmlns:a="{dml}">+ <p:nvSpPr><p:cNvPr id="{shape_id}" name="{name}"/><p:cNvSpPr/><p:nvPr/></p:nvSpPr>+ <p:spPr>+ <a:xfrm><a:off x="{x}" y="914400"/><a:ext cx="1828800" cy="914400"/></a:xfrm>+ <a:prstGeom prst="rect"><a:avLst/></a:prstGeom>+ <a:solidFill><a:srgbClr val="{color}"/></a:solidFill>+ <a:ln><a:noFill/></a:ln>+ </p:spPr>+</p:sp>''')++ with zipfile.ZipFile(path, 'r') as source:+ members = [(info, source.read(info.filename)) for info in source.infolist()]+ member_data = {info.filename: data for info, data in members}+ replacements: dict[str, bytes] = {}++ master_part = 'ppt/slideMasters/slideMaster1.xml'+ master_root = ET.fromstring(member_data[master_part])+ master_tree = master_root.find(f'{{{pml}}}cSld/{{{pml}}}spTree')+ assert master_tree is not None+ master_tree.append(inherited_shape('MASTER RED', 'FF0000', 901, 914400))+ master_c_sld = master_root.find(f'{{{pml}}}cSld')+ assert master_c_sld is not None+ old_background = master_c_sld.find(f'{{{pml}}}bg')+ background = ET.fromstring(f'''<p:bg xmlns:p="{pml}" xmlns:a="{dml}">+ <p:bgPr><a:solidFill><a:srgbClr val="00FF00"/></a:solidFill><a:effectLst/></p:bgPr>+</p:bg>''')+ if old_background is None:+ master_c_sld.insert(0, background)+ else:+ position = list(master_c_sld).index(old_background)+ master_c_sld.remove(old_background)+ master_c_sld.insert(position, background)+ replacements[master_part] = ET.tostring(+ master_root, encoding='utf-8', xml_declaration=True+ )++ layout_part = 'ppt/slideLayouts/slideLayout1.xml'+ layout_root = ET.fromstring(member_data[layout_part])+ if layout_value is None:+ layout_root.attrib.pop('showMasterSp', None)+ else:+ layout_root.set('showMasterSp', layout_value)+ layout_tree = layout_root.find(f'{{{pml}}}cSld/{{{pml}}}spTree')+ assert layout_tree is not None+ layout_tree.append(inherited_shape('LAYOUT BLUE', '0000FF', 902, 3657600))+ replacements[layout_part] = ET.tostring(+ layout_root, encoding='utf-8', xml_declaration=True+ )++ for index, value in enumerate(slide_values, start=1):+ slide_part = f'ppt/slides/slide{index}.xml'+ slide_root = ET.fromstring(member_data[slide_part])+ if value is None:+ slide_root.attrib.pop('showMasterSp', None)+ else:+ slide_root.set('showMasterSp', value)+ replacements[slide_part] = ET.tostring(+ slide_root, encoding='utf-8', xml_declaration=True+ )++ rewritten = path.with_name(f'{path.stem}-rewritten.pptx')+ with zipfile.ZipFile(rewritten, 'w') as target:+ for info, data in members:+ target.writestr(info, replacements.get(info.filename, data))+ rewritten.replace(path)+@staticmethoddef _text_bound_warnings(result: dict) -> list[str]:return [@@ -480,6 +571,209 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):(source_width, source_height),)+ def test_pptx_import_respects_master_shape_visibility(self):+ for raw, expected in (+ (None, True),+ ('1', True),+ ('true', True),+ ('0', False),+ ('false', False),+ ):+ with self.subTest(boolean=raw):+ self.assertEqual(+ parse_ooxml_boolean(+ raw,+ default=True,+ context='test showMasterSp',+ ),+ expected,+ )+ with self.assertRaisesRegex(RuntimeError, 'invalid boolean value'):+ parse_ooxml_boolean(+ 'TRUE',+ default=True,+ context='test showMasterSp',+ )++ with tempfile.TemporaryDirectory() as tmp_dir:+ root = Path(tmp_dir)+ invalid_path = root / 'invalid-layout-visibility.pptx'+ self._write_show_master_fixture(+ invalid_path,+ slide_values=['false'],+ layout_value='TRUE',+ )+ with self.assertRaisesRegex(+ RuntimeError,+ 'slideLayout1.xml showMasterSp: invalid boolean value',+ ):+ convert_pptx_to_svg(+ invalid_path,+ options=ConvertOptions(inheritance_mode='flat'),+ )++ source_path = root / 'slide-visibility.pptx'+ output_dir = root / 'slide-visibility-output'+ self._write_show_master_fixture(+ source_path,+ slide_values=[None, 'false'],+ )+ converted = convert_pptx_to_svg(+ source_path,+ output_dir=output_dir,+ options=ConvertOptions(inheritance_mode='both'),+ )+ visible, hidden = (artifact.svg for artifact in converted.flat_slides)+ self.assertIn('#FF0000', visible)+ self.assertIn('#0000FF', visible)+ self.assertIn('#00FF00', visible)+ self.assertNotIn('#FF0000', hidden)+ self.assertNotIn('#0000FF', hidden)+ self.assertIn('#00FF00', hidden)+ self.assertIn('SLIDE LOCAL 2', hidden)++ hidden_root = ET.fromstring(hidden)+ hidden_title = next(+ element+ for element in hidden_root.iter()+ if element.tag.rsplit('}', 1)[-1] == 'text'+ and 'SLIDE LOCAL 2' in ''.join(element.itertext())+ )+ self.assertGreater(float(hidden_title.get('x', '0')), 0)+ self.assertGreater(float(hidden_title.get('y', '0')), 0)++ self.assertTrue(any(+ '#FF0000' in artifact.svg for artifact in converted.masters+ ))+ self.assertTrue(any(+ '#0000FF' in artifact.svg for artifact in converted.layouts+ ))+ graph = json.loads(+ (output_dir / 'svg' / 'inheritance.json').read_text(+ encoding='utf-8'+ )+ )+ self.assertEqual(+ [slide['showInheritedShapes'] for slide in graph['slides']],+ [True, False],+ )+ self.assertTrue(all(+ slide['layout'] and slide['master']+ for slide in graph['slides']+ ))+ source_layout = next(+ layout+ for layout in graph['layouts']+ if layout['partPath'].endswith('slideLayout1.xml')+ )+ self.assertTrue(source_layout['showMasterShapes'])++ manifest = build_manifest(source_path, root / 'manifest-default')+ self.assertEqual(+ [slide['showInheritedShapes'] for slide in manifest['slides']],+ [True, False],+ )+ structure = build_native_structure(source_path, manifest)+ self.assertEqual(+ [slide['showInheritedShapes'] for slide in structure['slides']],+ [True, False],+ )++ layout_hidden_path = root / 'layout-visibility.pptx'+ layout_output_dir = root / 'layout-visibility-output'+ self._write_show_master_fixture(+ layout_hidden_path,+ slide_values=['1', 'true'],+ layout_value='false',+ )+ layout_hidden = convert_pptx_to_svg(+ layout_hidden_path,+ output_dir=layout_output_dir,+ options=ConvertOptions(inheritance_mode='both'),+ )+ for artifact in layout_hidden.flat_slides:+ flat = artifact.svg+ self.assertNotIn('#FF0000', flat)+ self.assertIn('#0000FF', flat)+ self.assertIn('#00FF00', flat)++ layout_graph = json.loads(+ (layout_output_dir / 'svg' / 'inheritance.json').read_text(+ encoding='utf-8'+ )+ )+ source_layout = next(+ layout+ for layout in layout_graph['layouts']+ if layout['partPath'].endswith('slideLayout1.xml')+ )+ self.assertFalse(source_layout['showMasterShapes'])+ self.assertTrue(all(+ slide['showInheritedShapes']+ for slide in layout_graph['slides']+ ))++ manifest = build_manifest(+ layout_hidden_path,+ root / 'manifest-layout-hidden',+ )+ manifest_layout = next(+ layout+ for layout in manifest['layouts']+ if layout['path'].endswith('slideLayout1.xml')+ )+ self.assertFalse(manifest_layout['showMasterShapes'])+ self.assertTrue(all(+ slide['showInheritedShapes'] for slide in manifest['slides']+ ))+ structure = build_native_structure(layout_hidden_path, manifest)+ structure_layout = next(+ layout+ for layout in structure['layouts']+ if layout['packagePart'].endswith('slideLayout1.xml')+ )+ self.assertFalse(structure_layout['showMasterShapes'])+ self.assertTrue(all(+ slide['showInheritedShapes'] for slide in structure['slides']+ ))++ layout_assets = {+ 'backgroundAsset': 'layout-background.png',+ 'shapeImageAssets': ['layout-shape.png'],+ 'showMasterShapes': False,+ }+ master_assets = {+ # The same media is both the overridden Master background and a+ # visible Master picture; shapeImageAssets must retain that use.+ 'backgroundAsset': 'master-shared.png',+ 'shapeImageAssets': ['master-shared.png'],+ }+ self.assertEqual(+ _effective_inherited_image_assets(+ show_inherited_shapes=False,+ layout_record=layout_assets,+ master_record=master_assets,+ ),+ set(),+ )+ self.assertEqual(+ _effective_inherited_image_assets(+ show_inherited_shapes=True,+ layout_record=layout_assets,+ master_record=master_assets,+ ),+ {'layout-shape.png'},+ )+ layout_assets['showMasterShapes'] = True+ self.assertEqual(+ _effective_inherited_image_assets(+ show_inherited_shapes=True,+ layout_record=layout_assets,+ master_record=master_assets,+ ),+ {'layout-shape.png', 'master-shared.png'},+ )+def test_top_level_group_ids_are_unique_animation_anchors(self):duplicate = '''<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><g id="card"><rect x="10" y="10" width="20" height="20" fill="#000000"/></g>diff --git a/skills/ppt-master/workflows/create-template.md b/skills/ppt-master/workflows/create-template.mdindex 094311f6..3df1c4f6 100644--- a/skills/ppt-master/workflows/create-template.md+++ b/skills/ppt-master/workflows/create-template.md@@ -104,8 +104,8 @@ python3 skills/ppt-master/scripts/pptx_template_import.py "<reference_template.pThis produces, in one workspace:-- `manifest.json` — single source of truth: slide size, theme colors, fonts, per-master theme summaries, asset inventory, placeholder metadata, SVG file paths, per-slide / per-layout / per-master metadata, page-type candidates-- `native_structure.json` — analysis contract: stable master/layout keys, layout picker names, placeholder type/index/geometry, source hash, and source-graph quality facts+- `manifest.json` — single source of truth: slide size, theme colors, fonts, per-master theme summaries, asset inventory, placeholder metadata, SVG file paths, per-slide / per-layout / per-master metadata (including source-owned inherited-shape visibility), page-type candidates+- `native_structure.json` — analysis contract: stable master/layout keys, layout picker names, placeholder type/index/geometry, inherited-shape visibility, source hash, and source-graph quality facts- `source_template.pptx` — byte-preserved analysis copy for visual/package cross-checking; it is not copied into the final template package- `summary.md` — short human-readable digest derived from manifest.json (for quick scanning only)- `assets/` — extracted reusable image assets; `manifest.json` owns the asset-name mapping and SVG `href` values reuse that mapping@@ -113,9 +113,9 @@ This produces, in one workspace:- `svg/master_*.svg` — every slide master in the deck rendered once, including masters that no sample slide currently uses (template packages routinely ship more masters than the visible samples reference)- `svg/layout_*.svg` — every slide layout in the deck rendered once (its own contribution; master shapes do **not** repeat here)- `svg/slide_NN.svg` — each slide's own shapes and slide-local background; master / layout shapes and backgrounds are **not** inlined here- - `svg/inheritance.json` — which layout & master each slide consumes+ - `svg/inheritance.json` — which Layout/Master each Slide consumes plus source-owned `showInheritedShapes` / `showMasterShapes` booleans; Layout shapes follow the Slide's `showInheritedShapes`, while Master shapes require that value and the referenced Layout's `showMasterShapes`; backgrounds remain independent- `svg-flat/` — **companion view** (one self-contained SVG per slide):- - `svg-flat/slide_NN.svg` — master + layout + slide painted into a single SVG so opening any slide on its own shows the full page like PowerPoint would. Use this for previews / screenshot pipelines / "what does the slide actually look like" sanity checks.+ - `svg-flat/slide_NN.svg` — effective Master/Layout contributions permitted by the source visibility flags plus Slide-local content, painted into one SVG so opening any slide on its own shows the full page like PowerPoint would. Background inheritance remains independent. Use this for previews / screenshot pipelines / "what does the slide actually look like" sanity checks.- The default `--inheritance-mode both` emits both views. Pass `layered` to skip `svg-flat/`, or `flat` for round-trip use cases (legacy: `svg/` becomes self-contained slides without the master/layout/inheritance files).Import fidelity rules: