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): validate path gradient types
hugohe3af3675d7a260
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.mdindex bf8d9971..b626a955 100644--- a/skills/ppt-master/references/shared-standards.md+++ b/skills/ppt-master/references/shared-standards.md@@ -761,6 +761,10 @@ An imported non-line `a:gradFill` contains at most one direct `a:lin` or`a:path` direction. Omitting both uses the schema-defined horizontal lineardefault; duplicate or mixed direction elements stop import instead of beingselected by implementation priority.+For the registered path-gradient approximation, omitted `a:path@path` uses the+schema default `rect`; explicit `circle`, `rect`, and `shape` are normalized to+the centered radial SVG form. Unknown or malformed enum values stop import+instead of being mislabeled as a supported radial gradient.The quality checker and exporter preflight both validate definition location,references, gradient structure, and paint context from the same closed contract.diff --git a/skills/ppt-master/scripts/pptx_to_svg/fill_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/fill_to_svg.pyindex 9bcd21a3..278e1012 100644--- a/skills/ppt-master/scripts/pptx_to_svg/fill_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/fill_to_svg.py@@ -182,6 +182,7 @@ def _resolve_grad_fill(elem: ET.Element, palette: ColorPalette | None,+ "</linearGradient>")elif rad is not None:+ _validate_path_gradient_type(rad)# Treat as radial regardless of path="circle" / "rect" / "shape" — SVG# only has circle/ellipse, and path="circle" maps to fillToRect=center.defs_xml = (@@ -265,6 +266,15 @@ def _validate_linear_gradient_scaling()+def _validate_path_gradient_type(path: ET.Element) -> None:+ """Require one registered DrawingML path-shade enum value."""+ path_type = path.get("path", "rect")+ if path_type not in {"circle", "rect", "shape"}:+ raise ValueError(+ f"Unsupported DrawingML path gradient type: {path_type!r}"+ )++def _resolve_blip_fill(_elem, _palette, _prefix, _seq, _placeholder_hex) -> FillResult:"""blipFill on <p:spPr> means a shape filled with an image — handled atpic_to_svg level. For now mark as transparent so the shape's outlinediff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.pyindex be5a5eaf..281faec7 100644--- a/skills/ppt-master/scripts/test_svg_quality_checker.py+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py@@ -3009,6 +3009,37 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):('0', '0', '1', '0'),)+ def test_native_path_gradient_type_must_be_registered(self):+ def resolve_path(path_type: str | None):+ path_attr = '' if path_type is None else f' path="{path_type}"'+ sp_pr = ET.fromstring(f'''+<p:spPr xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"+ xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">+ <a:gradFill>+ <a:gsLst>+ <a:gs pos="0"><a:srgbClr val="112233"/></a:gs>+ </a:gsLst>+ <a:path{path_attr}/>+ </a:gradFill>+</p:spPr>''')+ return resolve_fill(sp_pr, None)++ for path_type in (None, 'circle', 'rect', 'shape'):+ with self.subTest(valid_path_type=path_type):+ fill = resolve_path(path_type)+ self.assertEqual(+ ET.fromstring(fill.defs[0]).tag,+ 'radialGradient',+ )++ for path_type in ('', 'Circle', 'ellipse', 'futurePath'):+ with self.subTest(invalid_path_type=path_type):+ with self.assertRaisesRegex(+ ValueError,+ 'Unsupported DrawingML path gradient type',+ ):+ resolve_path(path_type)+def test_compound_native_line_is_rejected_on_import(self):for compound in ('dbl', 'thickThin', 'thinThick', 'tri'):with self.subTest(compound=compound):