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 lossy outer shadow imports
hugohe30c974fd2a087
diff --git a/skills/ppt-master/scripts/pptx_to_svg/effect_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/effect_to_svg.pyindex 4b8c998d..7ea6e400 100644--- a/skills/ppt-master/scripts/pptx_to_svg/effect_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/effect_to_svg.py@@ -24,6 +24,28 @@ _OOXML_HEX_COLOR_RE = re.compile(r"[0-9A-Fa-f]{6}")_DRAWINGML_NAMESPACE = NS["a"]_DRAWINGML_TAG_PREFIX = f"{{{_DRAWINGML_NAMESPACE}}}"_EFFECT_CONTAINER_NAMES = frozenset({"effectLst", "effectDag"})+_OUTER_SHADOW_ATTRIBUTES = frozenset({+ "algn",+ "blurRad",+ "dir",+ "dist",+ "kx",+ "ky",+ "rotWithShape",+ "sx",+ "sy",+})+_OUTER_SHADOW_ALIGNMENTS = frozenset({+ "b",+ "bl",+ "br",+ "ctr",+ "l",+ "r",+ "t",+ "tl",+ "tr",+})@dataclass(frozen=True)@@ -75,6 +97,7 @@ def convert_effects(*,id_prefix: str = "fx",id_seq: list[int] | None = None,+ target_rotation_degrees: float = 0.0,) -> EffectResult:"""Return one supported filter or blocking metadata for source effects."""if sp_pr is None:@@ -121,6 +144,15 @@ def convert_effects()try:if effect_name == "outerShdw":+ unsupported_attributes = _unsupported_outer_shadow_attributes(+ effect,+ target_rotation_degrees=target_rotation_degrees,+ )+ if unsupported_attributes:+ return EffectResult.unsupported(+ "unsupported-effect-attributes:outerShdw:"+ + ",".join(unsupported_attributes)+ )primitives = _outer_shadow(effect, palette)elif effect_name == "glow":primitives = _glow(effect, palette)@@ -262,6 +294,55 @@ def _effect_integer(return value+def _unsupported_outer_shadow_attributes(+ elem: ET.Element,+ *,+ target_rotation_degrees: float,+) -> tuple[str, ...]:+ """Return source shadow attributes the local SVG filter cannot preserve."""+ unsupported = set(elem.attrib) - _OUTER_SHADOW_ATTRIBUTES+ neutral_transforms = (+ ("sx", 100000),+ ("sy", 100000),+ ("kx", 0),+ ("ky", 0),+ )+ for attr, neutral in neutral_transforms:+ if attr in elem.attrib and _effect_integer(elem, attr) != neutral:+ unsupported.add(attr)++ raw_alignment = elem.get("algn")+ if (+ raw_alignment is not None+ and raw_alignment.strip() not in _OUTER_SHADOW_ALIGNMENTS+ ):+ raise ValueError(f"algn={raw_alignment!r}")++ raw_rotates = elem.get("rotWithShape")+ if raw_rotates is None:+ rotates_with_shape = True+ else:+ token = raw_rotates.strip()+ if token in {"1", "true"}:+ rotates_with_shape = True+ elif token in {"0", "false"}:+ rotates_with_shape = False+ else:+ raise ValueError(f"rotWithShape={raw_rotates!r}")+ target_is_rotated = not math.isclose(+ math.remainder(target_rotation_degrees, 360.0),+ 0.0,+ abs_tol=1e-9,+ )+ if rotates_with_shape and target_is_rotated:+ # CT_OuterShadowEffect defaults rotWithShape to true, while the local+ # SVG-to-PPTX mapping writes false. Blocking the visible distinction+ # prevents the next export from changing the source shadow direction.+ unsupported.add("rotWithShape")++ return tuple(sorted(unsupported))++def _direction_offset(elem: ET.Element) -> tuple[float, float]:"""Read dir / dist into (dx, dy) px."""direction_units = _effect_integer(diff --git a/skills/ppt-master/scripts/pptx_to_svg/shape_walker.py b/skills/ppt-master/scripts/pptx_to_svg/shape_walker.pyindex ca21020f..945e80bb 100644--- a/skills/ppt-master/scripts/pptx_to_svg/shape_walker.py+++ b/skills/ppt-master/scripts/pptx_to_svg/shape_walker.py@@ -74,6 +74,9 @@ class ShapeNode:placeholder: PlaceholderInfo | None = Noneinherited_lst_styles: tuple[ET.Element, ...] = ()inherited_body_properties: tuple[ET.Element, ...] = ()+ # Local plus ancestor group rotation; used for effect-fidelity decisions+ # without applying the group transform twice to the rendered geometry.+ effective_rotation: float = 0.0# GROUP only: children, in z-orderchildren: list["ShapeNode"] = field(default_factory=list)@@ -216,6 +219,7 @@ def _resolve_alternate_content(wrapper: ET.Element) -> ET.Element | None:def _walk_container(container: ET.Element,parent_group_xfrm: Xfrm | None,+ ancestor_rotation: float = 0.0,placeholder_xfrms: dict[tuple[str | None, str | None], Xfrm] | None = None,placeholder_lst_styles: dict[tuple[str | None, str | None],@@ -246,6 +250,7 @@ def _walk_container(name, spid, hidden, ph = _read_nv_sp_pr(child, nv_tag)xfrm = parse_xfrm(_resolve_xfrm(child, kind))+ effective_rotation = (ancestor_rotation + xfrm.rot) % 360.0# Placeholders without their own xfrm inherit geometry from a matching# placeholder in the layout, then the master. This is what PowerPoint@@ -285,11 +290,12 @@ def _walk_container(name=name, spid=spid, hidden=hidden, placeholder=ph,inherited_lst_styles=inherited_lst_styles,inherited_body_properties=inherited_body_properties,+ effective_rotation=effective_rotation,)if kind == GROUP:node.children = _walk_container(- child, xfrm,+ child, xfrm, effective_rotation,placeholder_xfrms=placeholder_xfrms,placeholder_lst_styles=placeholder_lst_styles,placeholder_body_properties=placeholder_body_properties,diff --git a/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.pyindex 17fb9ce0..8fb881e8 100644--- a/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/slide_to_svg.py@@ -772,6 +772,7 @@ def _build_geometry_xml(node: ShapeNode, sp_pr: ET.Element | None,ctx.palette,id_prefix="fx",id_seq=ctx.filter_seq,+ target_rotation_degrees=node.effective_rotation,)except ValueError as exc:if ctx.strict:@@ -969,6 +970,7 @@ def _convert_picture(node: ShapeNode, ctx: AssemblyContext, *, top_level: bool)ctx.palette,id_prefix="fx",id_seq=ctx.filter_seq,+ target_rotation_degrees=node.effective_rotation,)ctx.defs.extend(effect.defs)effect_metadata = dict(effect.metadata)