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(embed-icons): recognize a single-quoted preserve-color marker
hugohe305cf79cdebba
diff --git a/skills/ppt-master/scripts/svg_finalize/embed_icons.py b/skills/ppt-master/scripts/svg_finalize/embed_icons.pyindex 519a8067..733831f6 100644--- a/skills/ppt-master/scripts/svg_finalize/embed_icons.py+++ b/skills/ppt-master/scripts/svg_finalize/embed_icons.py@@ -143,6 +143,11 @@ def _base_geometry(base_size: BaseGeometry) -> tuple[float, float, float, float]return 0.0, 0.0, float(base_size), float(base_size)+# Either quote style: a single-quoted marker silently fell back to a recolored+# monochrome icon, dropping the asset's text, colors, and group transforms.+_PRESERVE_COLOR_RE = re.compile(r'data-icon-style\s*=\s*["\']preserve-color["\']')++def _is_preserve_color_asset(content: str) -> bool:"""Project illustrations are vector assets, not recolorable monochrome icons.@@ -150,7 +155,7 @@ def _is_preserve_color_asset(content: str) -> bool:extract_svg_assets.py and is the single source of truth — hand-authoredmulti-color assets must carry it to keep their colors and aspect ratio."""- return 'data-icon-style="preserve-color"' in content+ return _PRESERVE_COLOR_RE.search(content) is not Nonedef _detect_icon_style(content: str) -> str:diff --git a/skills/ppt-master/scripts/tests/test_embed_icons.py b/skills/ppt-master/scripts/tests/test_embed_icons.pyindex 8ff7d1c2..86f00cef 100644--- a/skills/ppt-master/scripts/tests/test_embed_icons.py+++ b/skills/ppt-master/scripts/tests/test_embed_icons.py@@ -13,6 +13,7 @@ if str(SCRIPTS_DIR) not in sys.path:sys.path.insert(0, str(SCRIPTS_DIR))from svg_finalize.embed_icons import ( # noqa: E402+ extract_paths_from_icon,generate_icon_group,parse_use_element,process_svg_file,@@ -120,3 +121,20 @@ class IconAttributeSecurityTests(unittest.TestCase):resolve_icon_color(attrs, style)with self.assertRaisesRegex(ValueError, f'Invalid icon {attribute}'):generate_icon_group(attrs, ['<path d="M0 0h1"/>'], style, 16)+++class PreserveColorMarkerTests(unittest.TestCase):+ def test_single_and_double_quoted_markers_both_preserve_the_asset(self) -> None:+ asset = (+ '<svg viewBox="0 0 48 24" data-icon-style={q}preserve-color{q}>'+ '<g transform="translate(8 0)"><rect width="20" height="20" fill="#ff0000"/>'+ '<text>A</text></g></svg>'+ )+ for quote in ("'", '"'):+ with self.subTest(quote=quote), \+ patch.object(Path, "exists", return_value=True), \+ patch.object(Path, "read_text", return_value=asset.format(q=quote)):+ parts, style, _ = extract_paths_from_icon(Path("logo.svg"))+ self.assertEqual(style, "preserve")+ self.assertIn("#ff0000", "".join(parts))+ self.assertIn("<text>", "".join(parts))