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(line-ends): preserve open arrow rendering

hugohe3202ad1ee4725
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 94ce7ef2..89225de0 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -170,7 +170,7 @@ when the referenced marker fits this native-arrow contract:
| Orientation | `orient="auto"` or `orient="auto-start-reverse"`; the latter reverses `marker-start` while behaving like `auto` at `marker-end` |
| Shape | One direct shape representing a DrawingML `triangle`, `stealth`, `arrow`, `diamond`, or `oval` line end: a 3-vertex `<polygon>` / closed path (triangle), a simple concave 4-vertex `<polygon>` / closed path (stealth), an open 3-vertex path (arrow), a simple convex 4-vertex `<polygon>` / closed path (diamond), or one `<circle>` / `<ellipse>` (oval) |
| Path grammar | Use one explicit `M`/`L` command per vertex. Triangle, stealth, and diamond paths end in `Z`; arrow paths remain open after the third vertex. Do not use `H`, `V`, curves, or an implicit multi-point `L` command inside a marker path |
-| Color parity | Marker fill matches the parent line stroke; DrawingML arrows inherit the line color |
+| Color parity | Triangle, stealth, diamond, and oval use a fill matching the parent line stroke. The open arrow uses `fill="none"` and a stroke matching the parent line stroke. DrawingML line ends inherit the line color |
The converter maps these five shapes to their corresponding DrawingML line-end
types. Prefer `<polygon>` for the closed triangle, stealth, and diamond forms;
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 77288795..edd1623f 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
@@ -223,6 +223,10 @@ def _build_arrow_marker(
if typ == "oval":
body = f'<circle cx="5" cy="5" r="4" fill="{stroke_color}"/>'
+ elif typ == "arrow":
+ body = (
+ f'<path d="{path}" fill="none" stroke="{stroke_color}"/>'
+ )
else:
body = f'<path d="{path}" fill="{stroke_color}"/>'
diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
index 7fc4ddd0..47d673f5 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
@@ -1947,6 +1947,11 @@ def project_marker_errors(root: ET.Element) -> list[str]:
not in PROJECT_NON_VISUAL_DEFINITION_CHILD_TAGS
]
shape = visual_children[0] if len(visual_children) == 1 else None
+ marker_shape_type = (
+ classify_project_marker_shape(marker)
+ if shape is not None
+ else None
+ )
if marker_id not in checked_markers:
checked_markers.add(marker_id)
marker_label = f'<marker id="{marker_id}">'
@@ -1990,7 +1995,6 @@ def project_marker_errors(root: ET.Element) -> list[str]:
f'{marker_label} child <{shape_tag}> cannot use '
'transform'
)
- marker_shape_type = classify_project_marker_shape(marker)
if marker_shape_type is None and shape_tag == 'path':
errors.add(
f'{marker_label} path must be a closed 3-vertex '
@@ -2023,26 +2027,38 @@ def project_marker_errors(root: ET.Element) -> list[str]:
'stroke',
parent_by_id,
)
- marker_fill = (
- _project_effective_presentation_value(
+ marker_fill = _project_effective_presentation_value(
+ shape,
+ 'fill',
+ parent_by_id,
+ ) or '#000000'
+ if marker_shape_type == 'arrow':
+ if marker_fill.strip().lower() != 'none':
+ errors.add(
+ f'{label} {attribute_name}=url(#{marker_id}) open '
+ 'arrow marker requires fill="none"'
+ )
+ marker_channel = 'stroke'
+ marker_paint = _project_effective_presentation_value(
shape,
- 'fill',
+ marker_channel,
parent_by_id,
- )
- or '#000000'
- )
+ ) or 'none'
+ else:
+ marker_channel = 'fill'
+ marker_paint = marker_fill
stroke_color, _stroke_alpha = parse_svg_color(stroke_value or '')
- fill_color, _fill_alpha = parse_svg_color(marker_fill)
- if stroke_color is None or fill_color is None:
+ marker_color, _marker_alpha = parse_svg_color(marker_paint)
+ if stroke_color is None or marker_color is None:
errors.add(
- f'{label} {attribute_name} marker fill and line stroke '
- 'must both be supported solid colors'
+ f'{label} {attribute_name} marker {marker_channel} and '
+ 'line stroke must both be supported solid colors'
)
- elif stroke_color != fill_color:
+ elif stroke_color != marker_color:
errors.add(
- f'{label} {attribute_name}=url(#{marker_id}) marker fill '
- f'{marker_fill!r} does not match effective line stroke '
- f'{stroke_value!r}'
+ f'{label} {attribute_name}=url(#{marker_id}) marker '
+ f'{marker_channel} {marker_paint!r} does not match '
+ f'effective line stroke {stroke_value!r}'
)
return sorted(errors)
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index dd1e0faf..a38fdb79 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -2560,6 +2560,10 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
reversed_=False,
)
marker = ET.fromstring(marker_markup)
+ if marker_type == 'arrow':
+ marker_path = next(iter(marker))
+ self.assertEqual(marker_path.get('fill'), 'none')
+ self.assertEqual(marker_path.get('stroke'), '#112233')
line = ET.fromstring(
'<line xmlns="http://www.w3.org/2000/svg" '
'stroke="#112233" '
@@ -2709,6 +2713,36 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
'invalid project line-end marker',
)
+ def test_open_arrow_marker_requires_matching_stroke(self):
+ cases = (
+ (
+ 'filled arrow',
+ 'fill="#112233"',
+ 'open arrow marker requires fill="none"',
+ ),
+ (
+ 'mismatched arrow stroke',
+ 'fill="none" stroke="#445566"',
+ "marker stroke '#445566' does not match effective line stroke",
+ ),
+ )
+ for label, marker_paint, expected in cases:
+ with self.subTest(label=label):
+ self._assert_checker_and_exporter_reject(
+ f'''<svg xmlns="http://www.w3.org/2000/svg"
+ viewBox="0 0 1280 720">
+ <defs>
+ <marker id="arrow" orient="auto">
+ <path d="M 0 0 L 10 5 L 0 10" {marker_paint}/>
+ </marker>
+ </defs>
+ <line x1="80" y1="80" x2="300" y2="80" stroke="#112233"
+ marker-end="url(#arrow)"/>
+</svg>''',
+ expected,
+ 'invalid project line-end marker',
+ )
+
def test_invalid_filter_contract_blocks_checker_and_exporter(self):
self._assert_checker_and_exporter_reject(
'''<svg xmlns="http://www.w3.org/2000/svg"