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 line caps

hugohe35cc1ee0c1275
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 7ea238d8..ecc6e44d 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -992,6 +992,9 @@ fidelity.
PPTX import accepts `a:ln@w` only as an integer DrawingML `ST_LineWidth` value
from `0` through `20116800` EMU. Malformed, negative, or oversized source widths
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.
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 0956f7b7..51877248 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
@@ -89,7 +89,9 @@ def resolve_stroke(
# Cap
cap = ln.attrib.get("cap")
- if cap and cap in CAP_MAP:
+ if cap is not None:
+ if cap not in CAP_MAP:
+ raise ValueError(f"Unsupported DrawingML line cap: {cap!r}")
attrs["stroke-linecap"] = CAP_MAP[cap]
# Fill: noFill / solidFill / gradFill
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index c373664c..8f705d15 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -2665,6 +2665,18 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
with self.assertRaisesRegex(ValueError, expected):
resolve_stroke(sp_pr, None)
+ def test_unknown_native_line_cap_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 cap="square"/>
+</p:spPr>''')
+ with self.assertRaisesRegex(
+ ValueError,
+ "Unsupported DrawingML line cap: 'square'",
+ ):
+ resolve_stroke(sp_pr, None)
+
def test_imported_head_end_uses_supported_reversible_orientation(self):
drawingml_ns = (
'http://schemas.openxmlformats.org/drawingml/2006/main'