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(svg-effects): close picture carrier ownership

hugohe34266f25e687d
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 dd44fbe5..255ef990 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/utils.py
@@ -2906,6 +2906,20 @@ def is_picture_effect_carrier(elem: ET.Element) -> bool:
if (
_svg_element_tag(elem) != 'g'
or elem.get('data-pptx-object') == 'group'
+ or re.fullmatch(
+ r'url\(#([^)]+)\)',
+ (elem.get('filter') or '').strip(),
+ ) is None
+ or any(
+ elem.get(attribute) is not None
+ for attribute in (
+ 'data-pptx-layer',
+ 'data-pptx-placeholder',
+ 'data-pptx-binding',
+ 'data-pptx-replace-with',
+ 'data-pptx-native',
+ )
+ )
):
return False
children = [
diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/template_structure.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/template_structure.py
index 6bd3b1c7..98d00b9e 100644
--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_package/template_structure.py
+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_package/template_structure.py
@@ -33,6 +33,7 @@ from pptx_to_svg.preset_authoring import (
)
from ..drawingml.utils import (
+ is_picture_effect_carrier,
parse_project_geometry_length,
project_geometry_length_errors,
)
@@ -1237,15 +1238,21 @@ def _validate_placeholder_carrier(
f"{svg_path.name}: {element_id} placeholder '{placeholder}' must be "
"carried by one direct <text> child"
)
- if placeholder == "picture" and tag not in {"image", "svg"}:
+ picture_carrier = (
+ tag in {"image", "svg"}
+ or (tag == "g" and is_picture_effect_carrier(carrier))
+ )
+ if placeholder == "picture" and not picture_carrier:
raise TemplateStructureError(
f"{svg_path.name}: {element_id} picture placeholder must be declared "
- "with one direct <image> or crop <svg> carrier"
+ "with one direct <image>, crop <svg>, or exact clipped-picture "
+ "effect carrier"
)
- if placeholder == "media" and tag not in {"image", "svg"}:
+ if placeholder == "media" and not picture_carrier:
raise TemplateStructureError(
f"{svg_path.name}: {element_id} media placeholder must be declared "
- "with one direct <image> or crop <svg> carrier"
+ "with one direct <image>, crop <svg>, or exact clipped-picture "
+ "effect carrier"
)
if (
placeholder == "object"