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-end types

hugohe3c3e010396765
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index d2fbc9a6..47c97ab0 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -178,7 +178,9 @@ the open arrow form requires `<path>`. Four-vertex shapes must be simple and
non-degenerate: convex geometry maps to diamond and concave geometry maps to
stealth. Checker and exporter preflight consume this same contract; other
marker shapes have no native mapping and block export instead of being silently
-dropped.
+dropped. PPTX import likewise accepts only these five DrawingML line-end types
+(plus `none`); an unknown source value stops import instead of being relabeled
+as a supported shape.
---
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 2c1b4cec..4e8c314f 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
@@ -191,6 +191,8 @@ def _build_arrow_marker(
typ = end_elem.attrib.get("type", "")
if typ in ("none", ""):
return None, ""
+ if typ not in {"triangle", "stealth", "arrow", "diamond", "oval"}:
+ raise ValueError(f"Unsupported DrawingML line-end type: {typ!r}")
w_b = end_elem.attrib.get("w", "med")
l_b = end_elem.attrib.get("len", "med")
@@ -212,9 +214,6 @@ def _build_arrow_marker(
path = "M 0 5 L 5 0 L 10 5 L 5 10 z"
elif typ == "oval":
path = "" # use circle below
- else:
- # Unknown type — fall back to triangle so user still sees something
- path = "M 0 0 L 10 5 L 0 10 z"
if typ == "oval":
body = f'<circle cx="5" cy="5" r="4" fill="{stroke_color}"/>'
@@ -222,7 +221,6 @@ def _build_arrow_marker(
body = f'<path d="{path}" fill="{stroke_color}"/>'
orient = "auto-start-reverse" if reversed_ else "auto"
- fill_attr = "" if typ == "arrow" else "" # no extra
# Note: stroke="none" prevents marker from inheriting parent stroke.
marker_def = (
f'<marker id="{marker_id}" viewBox="0 0 10 10" '
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index a02b7649..e23a8993 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -46,7 +46,7 @@ from pptx_to_svg.effect_to_svg import (
)
from pptx_to_svg.preset_registry_to_svg import render_preset_geometry
from pptx_to_svg.preset_svg_markup import serialize_preset_layers
-from pptx_to_svg.ln_to_svg import _build_arrow_marker
+from pptx_to_svg.ln_to_svg import _build_arrow_marker, resolve_stroke
from pptx_to_svg.converter import ConvertOptions, convert_pptx_to_svg
from pptx_to_svg.ooxml_loader import parse_ooxml_boolean
from pptx_to_svg.txbody_to_svg import convert_txbody, convert_vertical_txbody
@@ -2618,6 +2618,18 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
slide_xml,
)
+ def test_unknown_native_line_end_shape_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:tailEnd type="futureArrow"/></a:ln>
+</p:spPr>''')
+ with self.assertRaisesRegex(
+ ValueError,
+ "Unsupported DrawingML line-end type: 'futureArrow'",
+ ):
+ resolve_stroke(sp_pr, None)
+
def test_imported_head_end_uses_supported_reversible_orientation(self):
drawingml_ns = (
'http://schemas.openxmlformats.org/drawingml/2006/main'