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): close gradient stop structure
hugohe33fa5482ac4c1
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.mdindex 0ff1d7cb..906c7a55 100644--- a/skills/ppt-master/references/shared-standards.md+++ b/skills/ppt-master/references/shared-standards.md@@ -749,6 +749,10 @@ An explicit non-line imported `a:gradFill` requires exactly one attribute-freestop must provide a resolvable color. Missing or duplicate lists, undersized ormalformed lists, and unresolvable stops stop import instead of becoming aninherited fill or a partial gradient.+Each imported `a:gs` has exactly the required `pos` attribute and exactly one+direct registered DrawingML color child, with no interleaved text. Extra or+namespaced attributes, missing/multiple/foreign color children, and text payload+stop import instead of being reduced to the first recognizable color.An imported non-line `a:lin@ang` may be omitted for the schema-defined zerodefault. When present, it must be an integer from `0` through `21599999`(1/60000 degree); malformed or out-of-range values stop import instead ofdiff --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 c14f4518..a574a625 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@@ -18,7 +18,12 @@ from dataclasses import dataclass, fieldfrom decimal import Decimalfrom xml.etree import ElementTree as ET-from .color_resolver import ColorPalette, find_color_elem, resolve_color+from .color_resolver import (+ COLOR_TAGS,+ ColorPalette,+ find_color_elem,+ resolve_color,+)from .emu_units import (ANGLE_UNIT,NS,@@ -144,7 +149,7 @@ def _resolve_grad_fill(elem: ET.Element, palette: ColorPalette | None,stops_xml = []for gs in gradient_stops:pos_pct = _gradient_stop_position(gs)- color_elem = find_color_elem(gs)+ color_elem = _gradient_stop_color(gs)hex_, alpha = resolve_color(color_elem,palette,@@ -252,6 +257,21 @@ def _gradient_stop_list(gs_list: ET.Element) -> list[ET.Element]:return stops+def _gradient_stop_color(gs: ET.Element) -> ET.Element:+ """Return the single registered color child of one gradient stop."""+ children = list(gs)+ color_tags = {f"{{{NS['a']}}}{name}" for name in COLOR_TAGS}+ if (+ set(gs.attrib) != {"pos"}+ or len(children) != 1+ or children[0].tag not in color_tags+ or (gs.text or "").strip()+ or (children[0].tail or "").strip()+ ):+ raise ValueError("Invalid DrawingML gradient stop structure")+ return children[0]++def _linear_gradient_angle(lin: ET.Element) -> int:"""Parse one optional DrawingML positive fixed angle."""raw = lin.get("ang")diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.pyindex b705341d..2fcb4309 100644--- a/skills/ppt-master/scripts/test_svg_quality_checker.py+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py@@ -2863,7 +2863,7 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):'<a:gs pos="0"/>''<a:gs pos="100000"><a:srgbClr val="445566"/></a:gs>''</a:gsLst>',- 'gradient stop color cannot be resolved',+ 'Invalid DrawingML gradient stop structure',),('<a:gsLst future="x">'@@ -2905,6 +2905,35 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):with self.assertRaisesRegex(ValueError, expected):resolve_fill(sp_pr, None)+ def test_native_gradient_stop_structure_must_be_closed(self):+ invalid_stops = (+ '<a:gs pos="0" future="x"><a:srgbClr val="112233"/></a:gs>',+ '<a:gs xmlns:future="urn:future" pos="0" future:mode="x">'+ '<a:srgbClr val="112233"/></a:gs>',+ '<a:gs pos="0"><a:srgbClr val="112233"/>'+ '<a:prstClr val="red"/></a:gs>',+ '<a:gs pos="0"><a:future/></a:gs>',+ '<a:gs pos="0">payload<a:srgbClr val="112233"/></a:gs>',+ '<a:gs pos="0"><a:srgbClr val="112233"/>payload</a:gs>',+ )+ for invalid_stop in invalid_stops:+ with self.subTest(invalid_stop=invalid_stop):+ 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>+ {invalid_stop}+ <a:gs pos="100000"><a:srgbClr val="445566"/></a:gs>+ </a:gsLst>+ </a:gradFill>+</p:spPr>''')+ with self.assertRaisesRegex(+ ValueError,+ 'Invalid DrawingML gradient stop structure',+ ):+ resolve_fill(sp_pr, None)+def test_native_linear_gradient_angle_must_be_valid(self):valid_angles = ((None, None, 0.0),