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): reject unknown preset dashes

hugohe3846b30985730
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index ecc6e44d..f8697695 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -995,6 +995,9 @@ stop import instead of being dropped and replaced by a default SVG line width.
An explicit source `a:ln@cap` must be `flat`, `rnd`, or `sq`, which map to SVG
`butt`, `round`, and `square`; unknown values stop import instead of falling
back to the SVG default cap.
+PPTX import maps only the registered DrawingML `prstDash` values; `solid`
+remains an intentional line with no SVG dash array, while an unknown source
+value stops import instead of being mistaken for `solid`.
The dash grammar is closed: exact lowercase `none`, or at least two finite
unitless numbers separated by whitespace or one comma. Generated SVG uses
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 51877248..28c7e659 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
@@ -126,7 +126,11 @@ def resolve_stroke(
prst_dash = ln.find("a:prstDash", NS)
if prst_dash is not None:
preset = prst_dash.attrib.get("val", "")
- dasharray = PRST_DASH_TO_ARRAY.get(preset)
+ if preset not in PRST_DASH_TO_ARRAY:
+ raise ValueError(
+ f"Unsupported DrawingML preset dash: {preset!r}"
+ )
+ dasharray = PRST_DASH_TO_ARRAY[preset]
if dasharray:
attrs["stroke-dasharray"] = dasharray
else:
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index 8f705d15..6e3ece4b 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -2677,6 +2677,18 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
):
resolve_stroke(sp_pr, None)
+ def test_unknown_native_preset_dash_is_rejected_on_import(self):
+ sp_pr = ET.fromstring('''
+<p:spPr xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"
+ xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
+ <a:ln><a:prstDash val="futureDash"/></a:ln>
+</p:spPr>''')
+ with self.assertRaisesRegex(
+ ValueError,
+ "Unsupported DrawingML preset dash: 'futureDash'",
+ ):
+ resolve_stroke(sp_pr, None)
+
def test_imported_head_end_uses_supported_reversible_orientation(self):
drawingml_ns = (
'http://schemas.openxmlformats.org/drawingml/2006/main'