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): preserve small custom dash stops

hugohe3f9f98c10d393
diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.md
index 254886fb..f9db1bcb 100644
--- a/skills/ppt-master/references/shared-standards.md
+++ b/skills/ppt-master/references/shared-standards.md
@@ -1001,7 +1001,9 @@ value stops import instead of being mistaken for `solid`.
An imported `a:custDash` contains one or more direct, empty `a:ds` children;
each stop has exactly `d` and `sp`, both positive OOXML integers. Missing or
extra fields, foreign children, malformed numbers, and values outside the
-positive 32-bit integer range stop import instead of being skipped.
+positive 32-bit integer range stop import instead of being skipped. Import
+formats converted dash lengths with enough decimal precision that a legal
+positive source value never becomes a zero SVG dash or gap.
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 89a719bd..7375eea1 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
@@ -168,8 +168,8 @@ def resolve_stroke(
values[name] = value
d_pct = values["d"]
sp_pct = values["sp"]
- ds_parts.append(fmt_num(d_pct / 100000.0 * sw, 2))
- ds_parts.append(fmt_num(sp_pct / 100000.0 * sw, 2))
+ ds_parts.append(fmt_num(d_pct / 100000.0 * sw, 10))
+ ds_parts.append(fmt_num(sp_pct / 100000.0 * sw, 10))
attrs["stroke-dasharray"] = " ".join(ds_parts)
# Join
diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.py
index cbf6e6e2..f8252f81 100644
--- a/skills/ppt-master/scripts/test_svg_quality_checker.py
+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py
@@ -2729,6 +2729,20 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):
stroke = resolve_stroke(sp_pr, None)
self.assertEqual(stroke.attrs['stroke-dasharray'], '1 2 3 4')
+ def test_native_custom_dash_keeps_minimum_positive_stop(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 w="9525">
+ <a:custDash><a:ds d="1" sp="2"/></a:custDash>
+ </a:ln>
+</p:spPr>''')
+ stroke = resolve_stroke(sp_pr, None)
+ self.assertEqual(
+ stroke.attrs['stroke-dasharray'],
+ '0.00001 0.00002',
+ )
+
def test_imported_head_end_uses_supported_reversible_orientation(self):
drawingml_ns = (
'http://schemas.openxmlformats.org/drawingml/2006/main'