Skip to content

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 no-fill structure

hugohe33cf6f2027181
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 28a1414d..aa2d0945 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -721,6 +721,9 @@ foreign-namespace aliases stop import instead of being selected by
implementation priority. Explicit `a:grpFill` also stops import until group
fill inheritance has a registered SVG mapping; an omitted fill continues to
use the owning container's inheritance/default contract.
+Every imported `a:noFill`, including line paint, is an attribute-free empty
+leaf. Attributes, child elements, or text payload stop import instead of being
+discarded while the paint is normalized to `none`.
---
diff --git a/skills/ppt-master/scripts/pptx_to_svg/color_resolver.py b/skills/ppt-master/scripts/pptx_to_svg/color_resolver.py
index 70b60122..f3748da8 100644
--- a/skills/ppt-master/scripts/pptx_to_svg/color_resolver.py
+++ b/skills/ppt-master/scripts/pptx_to_svg/color_resolver.py
@@ -164,6 +164,12 @@ COLOR_TAGS = ("srgbClr", "schemeClr", "sysClr", "prstClr",
"hslClr", "scrgbClr")
+def validate_no_fill(elem: ET.Element) -> None:
+ """Require the empty DrawingML a:noFill leaf contract."""
+ if elem.attrib or list(elem) or (elem.text or "").strip():
+ raise ValueError("Invalid DrawingML noFill structure")
+
+
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.py
index 8b6808a3..d963db17 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,
+ validate_no_fill,
)
from .emu_units import (
ANGLE_UNIT,
@@ -152,7 +153,8 @@ def _drawingml_fill_name(elem: ET.Element) -> str | None:
# Per-fill handlers
# ---------------------------------------------------------------------------
-def _resolve_no_fill(_elem, _palette, _prefix, _seq, _placeholder_hex) -> FillResult:
+def _resolve_no_fill(elem, _palette, _prefix, _seq, _placeholder_hex) -> FillResult:
+ validate_no_fill(elem)
return FillResult.none_fill()
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.py
index 33f5eea3..67f41d8d 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
@@ -14,7 +14,12 @@ from xml.etree import ElementTree as ET
from pptx_shapes.formula import validate_ooxml_line_width
-from .color_resolver import ColorPalette, find_color_elem, resolve_color
+from .color_resolver import (
+ ColorPalette,
+ find_color_elem,
+ resolve_color,
+ validate_no_fill,
+)
from .emu_units import NS, emu_to_px, fmt_num, format_ooxml_alpha
@@ -126,6 +131,7 @@ def resolve_stroke(
if paint_name not in {None, "noFill", "solidFill", "gradFill"}:
raise ValueError(f"Unsupported DrawingML line paint: {paint_name}")
if paint_name == "noFill":
+ validate_no_fill(paint)
attrs["stroke"] = "none"
elif paint_name == "solidFill":
color_elem = find_color_elem(paint)
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index 836d0357..e7222296 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -2823,6 +2823,34 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
):
resolve_fill(foreign_fill, None)
+ def test_native_no_fill_must_be_an_empty_leaf(self):
+ invalid_no_fills = (
+ '<a:noFill future="x"/>',
+ '<a:noFill><a:future/></a:noFill>',
+ '<a:noFill>payload</a:noFill>',
+ )
+ namespace = (
+ 'xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"'
+ )
+ for no_fill in invalid_no_fills:
+ with self.subTest(route='fill', no_fill=no_fill):
+ fill = ET.fromstring(f'<a:fill {namespace}>{no_fill}</a:fill>')
+ with self.assertRaisesRegex(
+ ValueError,
+ 'Invalid DrawingML noFill structure',
+ ):
+ resolve_fill(fill, None)
+
+ with self.subTest(route='line', no_fill=no_fill):
+ sp_pr = ET.fromstring(
+ f'<a:spPr {namespace}><a:ln>{no_fill}</a:ln></a:spPr>'
+ )
+ with self.assertRaisesRegex(
+ ValueError,
+ 'Invalid DrawingML noFill structure',
+ ):
+ 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):