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 solid fill structure
hugohe389955eefe8b7
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.mdindex aa2d0945..f5be3563 100644--- a/skills/ppt-master/references/shared-standards.md+++ b/skills/ppt-master/references/shared-standards.md@@ -724,6 +724,13 @@ use the owning container's inheritance/default contract.Every imported `a:noFill`, including line paint, is an attribute-free emptyleaf. Attributes, child elements, or text payload stop import instead of beingdiscarded while the paint is normalized to `none`.+The general fill and line-paint import routes require an attribute-free+`a:solidFill` to contain exactly one direct registered DrawingML color child+with no interleaved text. Although Office can merge an omitted solid color from+style/master inheritance and ultimately default it to `schemeColor(bg1)`, the+local SVG mapping does not guess that external context: empty, malformed,+ambiguous, or unresolvable solid fills stop import instead of being treated as+an omitted fill or reduced to the first recognizable color.---diff --git a/skills/ppt-master/scripts/pptx_to_svg/color_resolver.py b/skills/ppt-master/scripts/pptx_to_svg/color_resolver.pyindex f3748da8..ce915148 100644--- a/skills/ppt-master/scripts/pptx_to_svg/color_resolver.py+++ b/skills/ppt-master/scripts/pptx_to_svg/color_resolver.py@@ -170,6 +170,37 @@ def validate_no_fill(elem: ET.Element) -> None:raise ValueError("Invalid DrawingML noFill structure")+def resolve_solid_fill_color(+ elem: ET.Element,+ palette: ColorPalette | None,+ *,+ placeholder_hex: str | None = None,+) -> tuple[str, float]:+ """Resolve one explicit color from a closed DrawingML solid fill."""+ children = list(elem)+ color_tags = {f"{{{NS['a']}}}{name}" for name in COLOR_TAGS}+ if not elem.attrib and not children and not (elem.text or "").strip():+ raise ValueError(+ "DrawingML solid fill requires one explicit color"+ )+ if (+ elem.attrib+ or len(children) != 1+ or children[0].tag not in color_tags+ or (elem.text or "").strip()+ or (children[0].tail or "").strip()+ ):+ raise ValueError("Invalid DrawingML solid fill structure")+ hex_, alpha = resolve_color(+ children[0],+ palette,+ placeholder_hex=placeholder_hex,+ )+ if hex_ is None:+ raise ValueError("DrawingML solid fill color cannot be resolved")+ return hex_, alpha++def find_color_elem(parent: ET.Element | None) -> ET.Element | None:"""Return the first child color element (any of the 6 OOXML color tags)."""if parent is None: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 d963db17..017f299b 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@@ -23,6 +23,7 @@ from .color_resolver import (ColorPalette,find_color_elem,resolve_color,+ resolve_solid_fill_color,validate_no_fill,)from .emu_units import (@@ -160,10 +161,11 @@ def _resolve_no_fill(elem, _palette, _prefix, _seq, _placeholder_hex) -> FillResdef _resolve_solid_fill(elem: ET.Element, palette: ColorPalette | None,_prefix: str, _seq, placeholder_hex: str | None) -> FillResult:- color_elem = find_color_elem(elem)- hex_, alpha = resolve_color(color_elem, palette, placeholder_hex=placeholder_hex)- if hex_ is None:- return FillResult.inherit()+ hex_, alpha = resolve_solid_fill_color(+ elem,+ palette,+ placeholder_hex=placeholder_hex,+ )attrs: dict[str, str] = {"fill": hex_}if alpha < 1.0:attrs["fill-opacity"] = format_ooxml_alpha(alpha)diff --git a/skills/ppt-master/scripts/pptx_to_svg/ln_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/ln_to_svg.pyindex 67f41d8d..7e613616 100644--- a/skills/ppt-master/scripts/pptx_to_svg/ln_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/ln_to_svg.py@@ -18,6 +18,7 @@ from .color_resolver import (ColorPalette,find_color_elem,resolve_color,+ resolve_solid_fill_color,validate_no_fill,)from .emu_units import NS, emu_to_px, fmt_num, format_ooxml_alpha@@ -134,10 +135,7 @@ def resolve_stroke(validate_no_fill(paint)attrs["stroke"] = "none"elif paint_name == "solidFill":- color_elem = find_color_elem(paint)- hex_, alpha = resolve_color(color_elem, palette)- if hex_ is None:- raise ValueError("DrawingML solid line color cannot be resolved")+ hex_, alpha = resolve_solid_fill_color(paint, palette)attrs["stroke"] = hex_if alpha < 1.0:attrs["stroke-opacity"] = format_ooxml_alpha(alpha)diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.pyindex e7222296..698e8d74 100644--- a/skills/ppt-master/scripts/test_svg_quality_checker.py+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py@@ -2851,6 +2851,56 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):):resolve_stroke(sp_pr, None)+ def test_native_solid_fill_requires_one_resolvable_color(self):+ invalid_solid_fills = (+ ('<a:solidFill/>', 'requires one explicit color'),+ (+ '<a:solidFill future="x">'+ '<a:srgbClr val="112233"/></a:solidFill>',+ 'Invalid DrawingML solid fill structure',+ ),+ (+ '<a:solidFill><a:srgbClr val="112233"/>'+ '<a:prstClr val="red"/></a:solidFill>',+ 'Invalid DrawingML solid fill structure',+ ),+ (+ '<a:solidFill><a:future/></a:solidFill>',+ 'Invalid DrawingML solid fill structure',+ ),+ (+ '<a:solidFill>payload<a:srgbClr val="112233"/>'+ '</a:solidFill>',+ 'Invalid DrawingML solid fill structure',+ ),+ (+ '<a:solidFill><a:srgbClr val="112233"/>payload'+ '</a:solidFill>',+ 'Invalid DrawingML solid fill structure',+ ),+ (+ '<a:solidFill><a:schemeClr val="accent1"/></a:solidFill>',+ 'solid fill color cannot be resolved',+ ),+ )+ namespace = (+ 'xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"'+ )+ for solid_fill, expected in invalid_solid_fills:+ with self.subTest(route='fill', solid_fill=solid_fill):+ fill = ET.fromstring(+ f'<a:fill {namespace}>{solid_fill}</a:fill>'+ )+ with self.assertRaisesRegex(ValueError, expected):+ resolve_fill(fill, None)++ with self.subTest(route='line', solid_fill=solid_fill):+ sp_pr = ET.fromstring(+ f'<a:spPr {namespace}><a:ln>{solid_fill}</a:ln></a:spPr>'+ )+ with self.assertRaisesRegex(ValueError, expected):+ resolve_stroke(sp_pr, None)+def test_native_gradient_stop_position_round_trips(self):for position in (0, 1, 7, 13, 33333, 99999, 100000):with self.subTest(position=position):@@ -3534,7 +3584,7 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):),('<a:solidFill/>',- 'DrawingML solid line color cannot be resolved',+ 'DrawingML solid fill requires one explicit color',),('<a:gradFill/>',