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): preserve compound effect diagnostics
hugohe3928fe40c73d0
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.mdindex fd0ab3b8..914afc84 100644--- a/skills/ppt-master/references/shared-standards.md+++ b/skills/ppt-master/references/shared-standards.md@@ -279,6 +279,12 @@ attributes, and no separate source-payload opt-in marker exists.| `data-pptx-effect-status="unsupported"` + `data-pptx-effect-reason` | Imported `p:sp` / `p:cxnSp` logical object and native carrier; imported `p:pic` carrier and logical object; imported `p:grpSp` logical group; imported table `p:graphicFrame` logical group | Record why an encountered source object or text-run `effectLst` / `effectDag` cannot enter the registered target-specific effect mapping without changing semantics. Checker and export stop with the recorded reason; these attributes are diagnostics, not a preserved effect payload or authoring syntax. || `metadata[data-pptx-part="txbody"]` | Logical shape `<g>` | Preserve unchanged `p:txBody`, including an empty text body. Content, whitespace, positioning, visible typography, or incompatible child-topology edits invalidate the payload. A source payload with run-level effects then blocks checker/export instead of losing those effects; an effect-free payload uses the normal SVG text fallback. |+One effect reason remains its existing plain token. If one imported object has+multiple independent unsupported reasons, both marker copies store the same+deduplicated, lexicographically sorted compact JSON string array in+`data-pptx-effect-reason`; adding a later reason must not overwrite an earlier+one. This array is still diagnostic metadata, not an authoring surface.+**Import/authoring representation split**:| Representation | Contract |@@ -815,6 +821,8 @@ keeps the visible table fallback, and stamps its imported `p:graphicFrame`logical group with the blocking effect status. The existing replacement statusstill records any independent table fallback reason; empty effect containersand effect-free cells remain eligible for the closed native Table schema.+If a shape has both an unsupported shape-level effect and one of these run-level+fallback reasons, the canonical compound marker records both reasons.This conditional guard is not a public run-effect authoring surface.The quality checker and exporter preflight enforce the same definition,reference, primitive, target, and numeric-value contract; malformed values arediff --git a/skills/ppt-master/scripts/pptx_effects.py b/skills/ppt-master/scripts/pptx_effects.pyindex d2415a80..be6517cc 100644--- a/skills/ppt-master/scripts/pptx_effects.py+++ b/skills/ppt-master/scripts/pptx_effects.py@@ -3,6 +3,7 @@from __future__ import annotations+import jsonfrom xml.etree import ElementTree as ET@@ -67,14 +68,35 @@ def project_effect_status_errors(root: ET.Element) -> list[str]:return sorted(errors)-def unsupported_effect_metadata(reason: str) -> dict[str, str]:- """Build the canonical import-only marker for an unsupported effect."""- reason = reason.strip()- if not reason:+def unsupported_effect_metadata(*reasons: str) -> dict[str, str]:+ """Build one canonical import marker without dropping compound reasons."""+ normalized: set[str] = set()+ for reason in reasons:+ reason = reason.strip()+ if not reason:+ raise ValueError("Unsupported PPTX effect reason must not be empty")+ items: object = reason+ if reason.startswith("["):+ try:+ items = json.loads(reason)+ except json.JSONDecodeError:+ pass+ if not isinstance(items, list):+ items = [reason]+ if not all(isinstance(item, str) and item.strip() for item in items):+ raise ValueError("Unsupported PPTX effect reasons must be strings")+ normalized.update(item.strip() for item in items)+ if not normalized:raise ValueError("Unsupported PPTX effect reason must not be empty")+ ordered = sorted(normalized)+ encoded = (+ ordered[0]+ if len(ordered) == 1+ else json.dumps(ordered, separators=(",", ":"))+ )return {EFFECT_STATUS_ATTR: UNSUPPORTED_EFFECT_STATUS,- EFFECT_REASON_ATTR: reason,+ EFFECT_REASON_ATTR: encoded,}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 068f19ca..d876dd89 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@@ -533,7 +533,15 @@ def _build_geometry_xml(node: ShapeNode, sp_pr: ET.Element | None,ctx.defs.extend(fill.defs)ctx.defs.extend(stroke.defs)ctx.defs.extend(effect.defs)- geom.attrs.update(dict(effect.metadata))+ effect_attrs = dict(effect.metadata)+ effect_reason = effect_attrs.get(EFFECT_REASON_ATTR)+ existing_reason = geom.attrs.get(EFFECT_REASON_ATTR)+ if effect_reason is not None and existing_reason is not None:+ effect_attrs.update(unsupported_effect_metadata(+ existing_reason,+ effect_reason,+ ))+ geom.attrs.update(effect_attrs)attrs = {**fill.attrs, **stroke.attrs}for key, value in style_defaults.items():diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.pyindex 670f6b74..dd9673a6 100644--- a/skills/ppt-master/scripts/test_svg_quality_checker.py+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py@@ -96,7 +96,11 @@ from template_import.manifest import (extract_placeholder_text_style,)from template_import.native_structure import build_native_structure-from pptx_effects import project_effect_status_errors, txbody_has_run_effects+from pptx_effects import (+ project_effect_status_errors,+ txbody_has_run_effects,+ unsupported_effect_metadata,+)class SVGQualityCheckerCompatibilityTests(unittest.TestCase):@@ -280,8 +284,11 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):def _write_vertical_run_effect_fixture(path: Path,effects: list[str | None],+ shape_effects: list[str | None] | None = None,) -> None:- """Write vertical text slides with supplied run-effect containers."""+ """Write vertical text slides with optional run and shape effects."""+ if shape_effects is not None and len(shape_effects) != len(effects):+ raise ValueError('shape_effects must match the run-effect count')presentation = Presentation()blank = presentation.slide_layouts[6]for index, _effect in enumerate(effects, start=1):@@ -331,6 +338,15 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):run.insert(0, run_properties)if effect_xml is not None:run_properties.append(ET.fromstring(effect_xml))+ shape_effect_xml = (+ shape_effects[index - 1]+ if shape_effects is not None+ else None+ )+ if shape_effect_xml is not None:+ shape_properties = target.find(f'{{{pml}}}spPr')+ assert shape_properties is not None+ shape_properties.append(ET.fromstring(shape_effect_xml))replacements[slide_part] = ET.tostring(slide_root,encoding='utf-8',@@ -3131,6 +3147,73 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):self.assertTrue(checker_result['passed'])convert_svg_to_slide_shapes(svg_path)+ def test_compound_shape_and_run_effect_reasons_are_preserved(self):+ reason_attr = 'data-pptx-effect-reason'+ normalized = unsupported_effect_metadata(+ 'reason-b',+ 'reason-a',+ 'reason-b',+ )+ self.assertEqual(+ json.loads(normalized[reason_attr]),+ ['reason-a', 'reason-b'],+ )+ self.assertEqual(+ unsupported_effect_metadata(normalized[reason_attr], 'reason-a'),+ normalized,+ )++ dml = 'http://schemas.openxmlformats.org/drawingml/2006/main'+ run_effect = f'''<a:effectLst xmlns:a="{dml}">+ <a:glow rad="38100"><a:srgbClr val="2563EB"/></a:glow>+</a:effectLst>'''+ shape_effect = (+ f'<a:effectLst xmlns:a="{dml}"><a:reflection/>'+ '</a:effectLst>'+ )+ expected_reasons = [+ 'unsupported-effect:reflection',+ 'unsupported-run-effect-route:vertical-text',+ ]+ with tempfile.TemporaryDirectory() as tmp_dir:+ root_dir = Path(tmp_dir)+ pptx_path = root_dir / 'compound-run-effects.pptx'+ self._write_vertical_run_effect_fixture(+ pptx_path,+ [run_effect],+ shape_effects=[shape_effect],+ )+ imported = convert_pptx_to_svg(+ pptx_path,+ options=ConvertOptions(inheritance_mode='flat'),+ )+ self.assertEqual(len(imported.slides), 1)+ artifact = imported.slides[0]+ root = ET.fromstring(artifact.svg)+ marked = [+ elem+ for elem in root.iter()+ if elem.get('data-pptx-effect-status') == 'unsupported'+ ]+ self.assertEqual(len(marked), 2)+ self.assertEqual(+ {+ tuple(json.loads(elem.get(reason_attr) or '[]'))+ for elem in marked+ },+ {tuple(expected_reasons)},+ )+ status_errors = project_effect_status_errors(root)+ self.assertEqual(len(status_errors), 1)+ for reason in expected_reasons:+ self.assertIn(reason, status_errors[0])+ self.assertNotIn('<filter', artifact.svg)+ self._assert_checker_and_exporter_reject(+ artifact.svg,+ expected_reasons[0],+ 'unsupported imported PPTX effect',+ )+def test_relationship_text_run_effect_import_fails_closed(self):dml = 'http://schemas.openxmlformats.org/drawingml/2006/main'run_effect = f'''<a:effectLst xmlns:a="{dml}">