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 unsupported effect downgrades
hugohe3afa22a039512
diff --git a/docs/powerpoint-svg-mapping.md b/docs/powerpoint-svg-mapping.mdindex b16a6b1d..00c5c4b3 100644--- a/docs/powerpoint-svg-mapping.md+++ b/docs/powerpoint-svg-mapping.md@@ -158,11 +158,11 @@ preset selection and authoring behavior are documented in| Dashed or dotted outline | Registered dash array | Preset or custom DrawingML dash | `Native-normalized` | Unsupported dash semantics are rejected || Line cap and join | Registered cap/join values | Native line cap/join properties | `Native-stable` | Only documented values are accepted || Line arrowheads | Registered start/end markers | Native head/tail end properties | `Approximate` for marker size | See the conditional marker contract |-| Outer shadow | One supported shadow filter graph | Native outer shadow in `a:effectLst` | `Approximate` | Unsupported graph shapes are not silently simplified |-| Glow | One supported glow filter graph | Native glow in `a:effectLst` | `Approximate` | Review when the glow carries semantic emphasis |+| Outer shadow | One supported shadow filter graph | Native outer shadow in `a:effectLst` | `Approximate`; one imported source `outerShdw` is reconstructed only when its non-zero offset remains classifiable | Zero-offset source shadows and unsupported graph shapes are not silently reclassified |+| Glow | One supported glow filter graph | Native glow in `a:effectLst` | `Approximate`; one imported source glow keeps the registered radius conversion | Review when the glow carries semantic emphasis || Whole-object transparency | Atomic element `opacity` | Alpha distributed into supported native channels | `Native-normalized` | Prefer channel-specific alpha unless the whole atomic object fades || Group transparency | Compatible `<g opacity>` | Descendant-normalized approximation | `Approximate` with a warning | Generated SVG should prefer descendant alpha |-| Inner shadow, soft edge, reflection, blur, turbulence, blend mode, or arbitrary mask | No registered native mapping | Explicit geometry alternative or raster asset | `Bake-required` | Converter and checker must not invent a visual downgrade |+| Inner shadow, soft edge, reflection, blur, turbulence, blend mode, or arbitrary mask | No registered native mapping | Explicit geometry alternative or raster asset | `Bake-required`; shape/connector PPTX import keeps the base object and emits blocking effect-status diagnostics for source effect containers | Handled shape/connector effects cannot be reclassified or omitted; picture, group, and text-run source effects remain outside this diagnostic path |## 7. PowerPoint tablesdiff --git a/docs/zh/powerpoint-svg-mapping.md b/docs/zh/powerpoint-svg-mapping.mdindex 7f37656b..29e35db3 100644--- a/docs/zh/powerpoint-svg-mapping.md+++ b/docs/zh/powerpoint-svg-mapping.md@@ -153,11 +153,11 @@ PowerPoint 意图| 虚线或点线轮廓 | 已登记 dash array | 预设或自定义 DrawingML dash | `Native-normalized` | 拒绝不支持的 dash 语义 || 线端与连接样式 | 已登记 cap/join 值 | 原生 line cap/join 属性 | `Native-stable` | 仅接受文档化取值 || 线条箭头 | 已登记起点/终点 marker | 原生 head/tail end 属性 | marker 大小为 `Approximate` | 见条件 marker 合同 |-| 外阴影 | 一个受支持 shadow filter 图 | `a:effectLst` 中的原生外阴影 | `Approximate` | 不会默默简化不支持的图结构 |-| 发光 | 一个受支持 glow filter 图 | `a:effectLst` 中的原生发光 | `Approximate` | 发光承载语义强调时需复核 |+| 外阴影 | 一个受支持 shadow filter 图 | `a:effectLst` 中的原生外阴影 | `Approximate`;仅当非零偏移仍可稳定分类时,才重建单一来源 `outerShdw` | 零偏移来源阴影和不支持的图结构不会被静默改成其他效果 |+| 发光 | 一个受支持 glow filter 图 | `a:effectLst` 中的原生发光 | `Approximate`;单一来源发光保持已登记的半径换算 | 发光承载语义强调时需复核 || 整个对象透明度 | 原子元素 `opacity` | alpha 分发至受支持原生通道 | `Native-normalized` | 除非整个原子对象需要淡出,否则优先通道专属 alpha || 组透明度 | 兼容 `<g opacity>` | 后代归一化近似 | `Approximate`,并产生 warning | 生成 SVG 应优先后代 alpha |-| 内阴影、柔化边缘、倒影、模糊、湍流、混合模式或任意 mask | 无已登记原生映射 | 显式几何替代或栅格资产 | `Bake-required` | 转换器和 Checker 不得发明视觉降级方案 |+| 内阴影、柔化边缘、倒影、模糊、湍流、混合模式或任意 mask | 无已登记原生映射 | 显式几何替代或栅格资产 | `Bake-required`;shape/connector 的 PPTX 回导保留基础对象,并对来源效果容器产生阻塞性的效果状态诊断 | 已处理的 shape/connector 效果不能被改成其他类型或静默省略;图片、组和文字 run 的来源效果尚不在该诊断路径内 |## 7. PowerPoint 表格diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.mdindex 04f49bcb..315b0cd1 100644--- a/skills/ppt-master/references/shared-standards.md+++ b/skills/ppt-master/references/shared-standards.md@@ -276,6 +276,7 @@ attributes, and no separate source-payload opt-in marker exists.| `data-pptx-geometry-kind="custom"` + `data-pptx-custgeom` | Custom-geometry carrier | Preserve the validated original `a:custGeom` subtree. If the visible path hash is unchanged, export restores formulas, handles, connection sites, text rectangle, and path list exactly; edited paths compile from current SVG geometry. || `data-pptx-start/end-shape-id/site` | Connector logical `<g>` and carrier | Restore `a:stCxn` / `a:endCxn` after scoped shape-id allocation. A connector may retain one zero frame axis; it must not be expanded from visible stroke or marker bounds. || `data-pptx-shape-style` | Native carrier | Preserve a relationship-free `p:style` independently of text, including shapes with no visible text. |+| `data-pptx-effect-status="unsupported"` + `data-pptx-effect-reason` | Imported `p:sp` / `p:cxnSp` logical shape and native carrier | Record why an encountered source `effectLst` / `effectDag` cannot enter the one-effect shadow/glow mapping without changing semantics. Checker and export stop with the recorded reason; these attributes are diagnostics, not a preserved effect payload or authoring syntax. || `metadata[data-pptx-part="txbody"]` | Logical shape `<g>` | Preserve unchanged `p:txBody`, including an empty text body. Content, whitespace, positioning, or visible typography edits invalidate the payload and use the normal SVG text fallback. |**Import/authoring representation split**:@@ -768,6 +769,17 @@ The sole `<g filter>` exception is the hash-lockedof an imported preset object and reference the same filter as that object's onehidden geometry carrier. The preview is render-only and never becomes a secondPowerPoint object; this exception does not authorize filters on ordinary groups.+PPTX shape/connector import emits a public filter only for exactly one source+`outerShdw` with a meaningful non-zero offset, or exactly one source `glow`.+Glow import uses the registered Gaussian/flood/composite graph and preserves+its radius conversion. Zero-offset outer shadow, duplicate or foreign-namespace+effect containers, multiple effects, `effectDag`, unknown effects, and invalid+numeric or color data receive the blocking §1.4 effect-status metadata instead+of being reclassified or silently omitted.+Each supported source effect must contain exactly one resolvable DrawingML+color choice. Malformed choices and valid color semantics outside the+registered color/modifier subset also receive effect-status metadata; the+importer never substitutes black or drops an unhandled modifier.The quality checker and exporter preflight enforce the same definition,reference, primitive, target, and numeric-value contract; malformed values arenever replaced by effect defaults during native export.@@ -1292,6 +1304,17 @@ halftone and route dense full-slide texture to §6.12.glow; it does not blur the object or backdrop. Use a low-alpha raster for densegrain and explicit circles/paths only for sparse editable marks.+**Hard rule — unsupported imported shape effects remain explicit**:+`pptx_to_svg.py` keeps the underlying `p:sp` / `p:cxnSp` object but stamps+blocking effect-status metadata for inner shadow, object blur, soft edge,+reflection, multiple effects, and effect DAGs.+Before release export, rasterize the affected object from the source PPTX or+rebuild its effect with supported explicit geometry; baking the effect-less+analysis SVG alone cannot recover the source appearance. This diagnostic path+currently covers `p:sp` / `p:cxnSp`; picture, group, and text-run source effects+remain outside it and are not claimed as preserved. Handled shape/connector+effects must never become outer shadow/glow or disappear without a diagnostic.+---### 6.13 Scenario Quick Referencediff --git a/skills/ppt-master/scripts/pptx_effects.py b/skills/ppt-master/scripts/pptx_effects.pynew file mode 100644index 00000000..a5f1120f--- /dev/null+++ b/skills/ppt-master/scripts/pptx_effects.py@@ -0,0 +1,68 @@+#!/usr/bin/env python3+"""Shared diagnostic contract for unsupported imported shape effects."""++from __future__ import annotations++from xml.etree import ElementTree as ET+++EFFECT_STATUS_ATTR = "data-pptx-effect-status"+EFFECT_REASON_ATTR = "data-pptx-effect-reason"+UNSUPPORTED_EFFECT_STATUS = "unsupported"+++def project_effect_status_errors(root: ET.Element) -> list[str]:+ """Return blocking diagnostics for invalid or unsupported effect metadata."""+ errors: set[str] = set()+ parents = {+ child: parent+ for parent in root.iter()+ for child in parent+ }+ for elem in root.iter():+ raw_status = elem.get(EFFECT_STATUS_ATTR)+ raw_reason = elem.get(EFFECT_REASON_ATTR)+ if raw_status is None and raw_reason is None:+ continue+ parent = parents.get(elem)+ if (+ parent is not None+ and parent.get(EFFECT_STATUS_ATTR) == raw_status+ and parent.get(EFFECT_REASON_ATTR) == raw_reason+ ):+ # Import duplicates the marker on the logical object and carrier+ # so stripping either copy cannot erase the block. Report it once.+ continue+ label = _element_label(elem)+ status = (raw_status or "").strip()+ if status != UNSUPPORTED_EFFECT_STATUS:+ errors.add(+ f'{label} {EFFECT_STATUS_ATTR} must equal '+ f'{UNSUPPORTED_EFFECT_STATUS!r}; got {raw_status!r}'+ )+ continue+ reason = (raw_reason or "").strip()+ if not reason:+ errors.add(+ f'{label} {EFFECT_REASON_ATTR} requires a non-empty reason'+ )+ continue+ errors.add(f'{label} has unsupported source PPTX effect: {reason}')+ return sorted(errors)+++def unsupported_effect_metadata(reason: str) -> dict[str, str]:+ """Build the canonical import-only marker for an unsupported effect."""+ reason = reason.strip()+ if not reason:+ raise ValueError("Unsupported PPTX effect reason must not be empty")+ return {+ EFFECT_STATUS_ATTR: UNSUPPORTED_EFFECT_STATUS,+ EFFECT_REASON_ATTR: reason,+ }+++def _element_label(elem: ET.Element) -> str:+ tag = elem.tag.rsplit("}", 1)[-1]+ elem_id = elem.get("id") or elem.get("data-name")+ return f'<{tag} id="{elem_id}">' if elem_id else f"<{tag}>"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 2749db6b..88df4930 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@@ -1,54 +1,130 @@-"""DrawingML <a:effectLst> -> SVG <filter> conversion.+"""Convert the closed DrawingML effect subset into project SVG filters.-Reverse of svg_to_pptx/drawingml/styles.py build_effect_xml.--Covers the most common DrawingML effects:-- <a:outerShdw> -> feDropShadow (or feGaussianBlur+feOffset+feFlood)-- <a:innerShdw> -> approximated via inverted SourceAlpha pipeline-- <a:glow> -> outer glow (no offset, uses flood color)-- <a:blur> -> feGaussianBlur on whole shape-- <a:softEdge> -> feGaussianBlur (approximation; SVG has no direct match)--Output: each call returns (filter_id, defs_xml). Caller adds filter="url(#id)"-to the shape and accumulates defs_xml into the slide's <defs>.+One classifiable outer shadow or one glow maps to the public shadow/glow+contract. Every other source effect receives explicit blocking metadata; the+importer never relabels it as another native effect or drops it silently."""from __future__ import annotationsimport math+import re+from dataclasses import dataclassfrom xml.etree import ElementTree as ET-from .color_resolver import ColorPalette, find_color_elem, resolve_color+from pptx_effects import unsupported_effect_metadata+from pptx_shapes.formula import OOXML_COORDINATE_MAX++from .color_resolver import COLOR_TAGS, ColorPalette, resolve_colorfrom .emu_units import NS, emu_to_px, fmt_num+_OOXML_INTEGER_RE = re.compile(r"[+-]?\d+")+_OOXML_HEX_COLOR_RE = re.compile(r"[0-9A-Fa-f]{6}")+_OOXML_INT_MIN = -(2**31)+_OOXML_INT_MAX = 2**31 - 1+_DRAWINGML_NAMESPACE = NS["a"]+_DRAWINGML_TAG_PREFIX = f"{{{_DRAWINGML_NAMESPACE}}}"+_EFFECT_CONTAINER_NAMES = frozenset({"effectLst", "effectDag"})+# Modulation/offset transforms use DrawingML percentage types, not all fixed+# percentages; values above 100% such as satMod=175000 are valid.+_COLOR_MODIFIER_PERCENT_RANGES = {+ "alpha": (0, 100000),+ "alphaMod": (0, _OOXML_INT_MAX),+ "alphaOff": (-100000, 100000),+ "hueMod": (0, _OOXML_INT_MAX),+ "lumMod": (_OOXML_INT_MIN, _OOXML_INT_MAX),+ "lumOff": (_OOXML_INT_MIN, _OOXML_INT_MAX),+ "satMod": (_OOXML_INT_MIN, _OOXML_INT_MAX),+ "satOff": (_OOXML_INT_MIN, _OOXML_INT_MAX),+ "shade": (0, 100000),+ "tint": (0, 100000),+}+_COLOR_MODIFIER_FLAG_NAMES = frozenset({"comp", "gray", "inv"})+++@dataclass(frozen=True)+class EffectResult:+ """One supported SVG filter or one explicit unsupported-source marker."""++ filter_id: str | None = None+ defs: tuple[str, ...] = ()+ metadata: tuple[tuple[str, str], ...] = ()++ @classmethod+ def unsupported(cls, reason: str) -> "EffectResult":+ return cls(metadata=tuple(unsupported_effect_metadata(reason).items()))++def convert_effects(sp_pr: ET.Element | None,palette: ColorPalette | None,*,id_prefix: str = "fx",id_seq: list[int] | None = None,-) -> tuple[str | None, list[str]]:- """Inspect <p:spPr> for <a:effectLst> and return (filter_id, defs_xml).-- If no effect is present returns (None, []). Multiple effects are layered- inside one <filter> using SVG primitive results.- """+) -> EffectResult:+ """Return one supported filter or blocking metadata for source effects."""if sp_pr is None:- return None, []- effect_lst = sp_pr.find("a:effectLst", NS)- if effect_lst is None:- return None, []- if len(list(effect_lst)) == 0:- return None, []+ return EffectResult()+ containers = [+ child+ for child in sp_pr+ if isinstance(child.tag, str)+ and _local_name(child) in _EFFECT_CONTAINER_NAMES+ ]+ if not containers:+ return EffectResult()+ container_names = [_local_name(child) for child in containers]+ if len(containers) != 1:+ return EffectResult.unsupported(+ "multiple-effect-containers:" + ",".join(container_names)+ )+ container = containers[0]+ container_name = container_names[0]+ if not container.tag.startswith(_DRAWINGML_TAG_PREFIX):+ return EffectResult.unsupported(+ f"invalid-effect-container-namespace:{container_name}"+ )+ if container_name == "effectDag":+ return EffectResult.unsupported("unsupported-effect-container:effectDag")+ effects = [+ child+ for child in container+ if isinstance(child.tag, str)+ ]+ if not effects:+ return EffectResult()+ names = [child.tag.split("}", 1)[-1] for child in effects]+ if len(effects) != 1:+ return EffectResult.unsupported(+ "multiple-effects:" + ",".join(names)+ )++ effect = effects[0]+ effect_name = names[0]+ if not effect.tag.startswith(_DRAWINGML_TAG_PREFIX):+ return EffectResult.unsupported(+ f"invalid-effect-namespace:{effect_name}"+ )+ try:+ if effect_name == "outerShdw":+ primitives = _outer_shadow(effect, palette)+ elif effect_name == "glow":+ primitives = _glow(effect, palette)+ else:+ return EffectResult.unsupported(+ f"unsupported-effect:{effect_name}"+ )+ except (OverflowError, TypeError, ValueError) as exc:+ return EffectResult.unsupported(+ f"invalid-effect:{effect_name}:{exc}"+ )if id_seq is None:id_seq = [0]id_seq[0] += 1filter_id = f"{id_prefix}{id_seq[0]}"- primitives: list[str] = []- last_result = "SourceGraphic"# Filter region needs to extend beyond the bounding box to render shadows# and glows; choose generous defaults.filter_x = "-25%"@@ -56,155 +132,201 @@ def convert_effects(filter_w = "150%"filter_h = "150%"- for child in list(effect_lst):- if not isinstance(child.tag, str):- continue- local = child.tag.split("}", 1)[-1]- prim, last_result = _convert_one_effect(child, last_result, palette)- if prim:- primitives.append(prim)-- if not primitives:- return None, []-defs_xml = (f'<filter id="{filter_id}" x="{filter_x}" y="{filter_y}" 'f'width="{filter_w}" height="{filter_h}">'- + "".join(primitives)+ + primitives+ "</filter>")- return filter_id, [defs_xml]---# ----------------------------------------------------------------------------# Per-effect conversion-# -----------------------------------------------------------------------------def _convert_one_effect(- elem: ET.Element,- last_result: str,- palette: ColorPalette | None,-) -> tuple[str, str]:- """Convert one effect to SVG filter primitives.-- Returns (primitives_xml, new_last_result_name).- """- local = elem.tag.split("}", 1)[-1]- if local == "outerShdw":- return _outer_shadow(elem, last_result, palette)- if local == "innerShdw":- return _inner_shadow(elem, last_result, palette)- if local == "glow":- return _glow(elem, last_result, palette)- if local == "blur":- return _blur(elem, last_result)- if local == "softEdge":- return _soft_edge(elem, last_result)- if local == "reflection":- # v1 approximation: skip (would require feImage + feFlood + transform)- return "", last_result- return "", last_result+ return EffectResult(filter_id=filter_id, defs=(defs_xml,))def _color_alpha(elem: ET.Element, palette: ColorPalette | None) -> tuple[str, float]:- color = find_color_elem(elem)+ direct_children = [+ child+ for child in elem+ if isinstance(child.tag, str)+ ]+ colors = [+ child+ for child in direct_children+ if _local_name(child) in COLOR_TAGS+ ]+ if len(colors) != 1:+ reason = "missing-color" if not colors else "multiple-colors"+ raise ValueError(reason)+ if len(direct_children) != 1:+ extras = [+ _local_name(child)+ for child in direct_children+ if child is not colors[0]+ ]+ raise ValueError("unexpected-effect-child:" + ",".join(extras))+ color = colors[0]+ if not color.tag.startswith(_DRAWINGML_TAG_PREFIX):+ raise ValueError(f"invalid-color-namespace:{_local_name(color)}")+ _validate_color(color, palette)hex_, alpha = resolve_color(color, palette)- return hex_ or "#000000", alpha+ if hex_ is None:+ raise ValueError(f"unresolvable-color:{_local_name(color)}")+ return hex_, alpha+++def _validate_color(+ color: ET.Element,+ palette: ColorPalette | None,+) -> None:+ """Validate the color subset resolved into one SVG filter paint."""+ color_name = _local_name(color)+ if color_name == "srgbClr":+ raw = color.get("val", "")+ if _OOXML_HEX_COLOR_RE.fullmatch(raw) is None:+ raise ValueError(f"invalid-color:{color_name}")+ elif color_name == "schemeClr":+ raw = (color.get("val") or "").strip()+ resolved = palette.resolve_scheme(raw) if palette is not None else None+ if resolved is None or _OOXML_HEX_COLOR_RE.fullmatch(resolved) is None:+ raise ValueError(f"unresolvable-color:{color_name}")+ elif color_name == "sysClr":+ raw = color.get("lastClr") or ""+ if _OOXML_HEX_COLOR_RE.fullmatch(raw) is None:+ raise ValueError(f"unresolvable-color:{color_name}")+ elif color_name == "hslClr":+ _required_integer(color, "hue", 0, 21_599_999)+ _required_integer(color, "sat", 0, 100000)+ _required_integer(color, "lum", 0, 100000)+ elif color_name == "scrgbClr":+ for attr in ("r", "g", "b"):+ _required_integer(color, attr, 0, 100000)+ elif not (color.get("val") or "").strip():+ raise ValueError(f"invalid-color:{color_name}")++ for modifier in color:+ if not isinstance(modifier.tag, str):+ continue+ modifier_name = _local_name(modifier)+ if not modifier.tag.startswith(_DRAWINGML_TAG_PREFIX):+ raise ValueError(+ f"invalid-color-modifier-namespace:{modifier_name}"+ )+ bounds = _COLOR_MODIFIER_PERCENT_RANGES.get(modifier_name)+ if bounds is not None:+ _required_integer(modifier, "val", *bounds)+ elif modifier_name == "hueOff":+ _required_integer(+ modifier,+ "val",+ _OOXML_INT_MIN,+ _OOXML_INT_MAX,+ )+ elif modifier_name not in _COLOR_MODIFIER_FLAG_NAMES:+ raise ValueError(f"unsupported-color-modifier:{modifier_name}")+++def _required_integer(+ elem: ET.Element,+ attr: str,+ minimum: int,+ maximum: int,+) -> int:+ raw = elem.get(attr)+ if raw is None:+ raise ValueError(f"missing-{_local_name(elem)}-{attr}")+ token = raw.strip()+ if _OOXML_INTEGER_RE.fullmatch(token) is None:+ raise ValueError(f"invalid-{_local_name(elem)}-{attr}")+ value = int(token)+ if not minimum <= value <= maximum:+ raise ValueError(f"invalid-{_local_name(elem)}-{attr}")+ return value+++def _local_name(elem: ET.Element) -> str:+ return elem.tag.rsplit("}", 1)[-1]+++def _effect_integer(+ elem: ET.Element,+ attr: str,+ *,+ default: int = 0,+ non_negative: bool = False,+ maximum: int | None = None,+) -> int:+ raw = elem.get(attr)+ if raw is None:+ value = default+ else:+ token = raw.strip()+ if _OOXML_INTEGER_RE.fullmatch(token) is None:+ raise ValueError(f"{attr}={raw!r}")+ value = int(token)+ if (+ (non_negative and value < 0)+ or (maximum is not None and value > maximum)+ ):+ raise ValueError(f"{attr}={raw!r}")+ return valuedef _direction_offset(elem: ET.Element) -> tuple[float, float]:"""Read dir / dist into (dx, dy) px."""- try:- direction_units = float(elem.attrib.get("dir", "0"))- dist_emu = float(elem.attrib.get("dist", "0"))- except ValueError:- return 0.0, 0.0+ direction_units = _effect_integer(+ elem,+ "dir",+ non_negative=True,+ maximum=21_599_999,+ )+ dist_emu = _effect_integer(+ elem,+ "dist",+ non_negative=True,+ maximum=OOXML_COORDINATE_MAX,+ )direction_deg = direction_units / 60000.0dist_px = emu_to_px(dist_emu)rad = math.radians(direction_deg)return dist_px * math.cos(rad), dist_px * math.sin(rad)-def _blur_radius(elem: ET.Element, attr: str = "blurRad", default_emu: float = 0.0) -> float:- try:- v = float(elem.attrib.get(attr, str(default_emu)))- except ValueError:- return 0.0- return emu_to_px(v)+def _blur_radius(elem: ET.Element, attr: str) -> float:+ return emu_to_px(_effect_integer(+ elem,+ attr,+ non_negative=True,+ maximum=OOXML_COORDINATE_MAX,+ ))-def _outer_shadow(elem: ET.Element, last_result: str,- palette: ColorPalette | None) -> tuple[str, str]:+def _outer_shadow(+ elem: ET.Element,+ palette: ColorPalette | None,+) -> str:dx, dy = _direction_offset(elem)blur = _blur_radius(elem, "blurRad")+ dx_token = fmt_num(dx, 8)+ dy_token = fmt_num(dy, 8)+ if abs(float(dx_token)) <= 0.01 and abs(float(dy_token)) <= 0.01:+ raise ValueError("offset-is-not-classifiable")color, alpha = _color_alpha(elem, palette)# std deviation ~= blur radius / 2 (rough; PowerPoint shadows are larger)- std = max(blur / 2.0, 0.1)+ std = blur / 2.0# Use feDropShadow for compactness — it's well-supported in modern browsers.return (- f'<feDropShadow dx="{fmt_num(dx)}" dy="{fmt_num(dy)}" '- f'stdDeviation="{fmt_num(std)}" '- f'flood-color="{color}" flood-opacity="{fmt_num(alpha, 4)}"/>',- "shadow",+ f'<feDropShadow dx="{dx_token}" dy="{dy_token}" '+ f'stdDeviation="{fmt_num(std, 8)}" '+ f'flood-color="{color}" flood-opacity="{fmt_num(alpha, 5)}"/>')-def _inner_shadow(elem: ET.Element, last_result: str,- palette: ColorPalette | None) -> tuple[str, str]:- """Inner shadow via inverted alpha + offset + blur + composite-in.-- Approximation: produces a darkened inner edge similar to PowerPoint.- """- dx, dy = _direction_offset(elem)- blur = _blur_radius(elem, "blurRad")- color, alpha = _color_alpha(elem, palette)- std = max(blur / 2.0, 0.1)- # Pipeline:- # feFlood (color) -> compose with inverted alpha -> blur -> offset ->- # composite-in original alpha- return (- f'<feFlood flood-color="{color}" flood-opacity="{fmt_num(alpha, 4)}" result="flood"/>'- f'<feComposite in="flood" in2="SourceAlpha" operator="out" result="inverted"/>'- f'<feGaussianBlur in="inverted" stdDeviation="{fmt_num(std)}" result="blurred"/>'- f'<feOffset in="blurred" dx="{fmt_num(dx)}" dy="{fmt_num(dy)}" result="offset"/>'- f'<feComposite in="offset" in2="SourceAlpha" operator="in" result="innerShadow"/>'- f'<feMerge><feMergeNode in="SourceGraphic"/><feMergeNode in="innerShadow"/></feMerge>',- "innerShadow",- )---def _glow(elem: ET.Element, last_result: str,- palette: ColorPalette | None) -> tuple[str, str]:+def _glow(elem: ET.Element, palette: ColorPalette | None) -> str:rad = _blur_radius(elem, "rad")color, alpha = _color_alpha(elem, palette)- std = max(rad / 2.0, 0.1)+ # svg_to_pptx maps stdDeviation directly back to a:glow@rad.+ std = radreturn (- f'<feMorphology operator="dilate" radius="{fmt_num(rad / 4.0)}" '- f'in="SourceAlpha" result="dilated"/>'- f'<feGaussianBlur in="dilated" stdDeviation="{fmt_num(std)}" result="blurred"/>'- f'<feFlood flood-color="{color}" flood-opacity="{fmt_num(alpha, 4)}" result="flood"/>'+ f'<feGaussianBlur in="SourceAlpha" stdDeviation="{fmt_num(std, 8)}" result="blurred"/>'+ f'<feFlood flood-color="{color}" flood-opacity="{fmt_num(alpha, 5)}" result="flood"/>'f'<feComposite in="flood" in2="blurred" operator="in" result="glow"/>'- f'<feMerge><feMergeNode in="glow"/><feMergeNode in="SourceGraphic"/></feMerge>',- "glow",- )---def _blur(elem: ET.Element, last_result: str) -> tuple[str, str]:- rad = _blur_radius(elem, "rad")- std = max(rad / 2.0, 0.1)- return (- f'<feGaussianBlur stdDeviation="{fmt_num(std)}"/>',- "blurred",- )---def _soft_edge(elem: ET.Element, last_result: str) -> tuple[str, str]:- # softEdge fades the edges; approximate with an alpha-only Gaussian blur- # then composite-in. v1 just outputs a gentle blur.- rad = _blur_radius(elem, "rad")- std = max(rad / 4.0, 0.1)- return (- f'<feGaussianBlur in="SourceAlpha" stdDeviation="{fmt_num(std)}" result="softEdge"/>'- f'<feComposite in="SourceGraphic" in2="softEdge" operator="in"/>',- "softEdge",+ f'<feMerge><feMergeNode in="glow"/><feMergeNode in="SourceGraphic"/></feMerge>')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 95708c3c..76eb40f0 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@@ -35,6 +35,7 @@ from pptx_shapes import (svg_native_fallback_markup_fingerprint,svg_text_fingerprint,)+from pptx_effects import EFFECT_REASON_ATTR, EFFECT_STATUS_ATTRfrom .color_resolver import ColorPalette, find_color_elem, resolve_colorfrom .chart_to_svg import CHART_URI, CHARTEX_URI, extract_native_chart_payload@@ -498,19 +499,23 @@ def _build_geometry_xml(node: ShapeNode, sp_pr: ET.Element | None,id_prefix="m", id_seq=ctx.marker_seq,style_stroke_default=style_defaults.get("stroke"),)- filter_id, effect_defs = convert_effects(sp_pr, ctx.palette,- id_prefix="fx",- id_seq=ctx.filter_seq)+ effect = convert_effects(+ sp_pr,+ ctx.palette,+ id_prefix="fx",+ id_seq=ctx.filter_seq,+ )ctx.defs.extend(fill.defs)ctx.defs.extend(stroke.defs)- ctx.defs.extend(effect_defs)+ ctx.defs.extend(effect.defs)+ geom.attrs.update(dict(effect.metadata))attrs = {**fill.attrs, **stroke.attrs}for key, value in style_defaults.items():attrs.setdefault(key, value)- if filter_id is not None:- attrs["filter"] = f"url(#{filter_id})"+ if effect.filter_id is not None:+ attrs["filter"] = f"url(#{effect.filter_id})"# Default fill / stroke when not specified by spPr (matches PowerPoint# behavior: a:noFill on shape-level fill if there's a txBody, else any@@ -1216,6 +1221,8 @@ def _geometry_group_attrs(geom: GeomResult | None) -> list[str]:"data-pptx-preview-sha256","data-pptx-geometry-status","data-pptx-geometry-reason",+ EFFECT_STATUS_ATTR,+ EFFECT_REASON_ATTR,)attrs: list[str] = []for key, value in geom.attrs.items():diff --git a/skills/ppt-master/scripts/svg_quality_checker.py b/skills/ppt-master/scripts/svg_quality_checker.pyindex 559c652b..50d978bc 100644--- a/skills/ppt-master/scripts/svg_quality_checker.py+++ b/skills/ppt-master/scripts/svg_quality_checker.py@@ -31,6 +31,17 @@ except ImportError:print("Warning: Unable to import project_utils")CANVAS_FORMATS = {}+try:+ from pptx_effects import (+ EFFECT_REASON_ATTR as _EFFECT_REASON_ATTR,+ EFFECT_STATUS_ATTR as _EFFECT_STATUS_ATTR,+ project_effect_status_errors as _project_effect_status_errors,+ )+except ImportError:+ _EFFECT_REASON_ATTR = 'data-pptx-effect-reason'+ _EFFECT_STATUS_ATTR = 'data-pptx-effect-status'+ _project_effect_status_errors = None+from svg_to_pptx.canvas_contract import (CanvasContractError,parse_project_svg_root,@@ -1245,6 +1256,7 @@ class SVGQualityChecker:self._check_clip_path_contract(root, result)# 2h. Validate the supported shadow/glow filter interface.+ self._check_imported_effect_status(root, result)self._check_filter_effects(root, result)# 2i. Validate gradient definitions, stops, and coordinates.@@ -2004,6 +2016,25 @@ class SVGQualityChecker:returnresult['errors'].extend(_project_filter_errors(root))+ def _check_imported_effect_status(+ self,+ root: ET.Element,+ result: Dict,+ ) -> None:+ """Reject source PPTX effects that have no faithful SVG mapping."""+ if _project_effect_status_errors is None:+ if any(+ elem.get(_EFFECT_STATUS_ATTR) is not None+ or elem.get(_EFFECT_REASON_ATTR) is not None+ for elem in root.iter()+ ):+ result['errors'].append(+ 'Unable to import the PPTX effect-status validator; '+ 'cannot verify imported effect fidelity'+ )+ return+ result['errors'].extend(_project_effect_status_errors(root))+def _check_gradient_interfaces(self, root: ET.Element, result: Dict) -> None:"""Validate the normalized native gradient authoring interface."""if (diff --git a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.pyindex fd828e79..657fd58a 100644--- a/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py+++ b/skills/ppt-master/scripts/svg_to_pptx/drawingml/converter.py@@ -18,6 +18,7 @@ from pptx_shapes import (svg_text_fingerprint,validate_ooxml_xfrm,)+from pptx_effects import project_effect_status_errorsfrom pptx_to_svg.preset_authoring import (materialize_compact_authored_preset_tree,validate_authored_preset_tree,@@ -338,6 +339,22 @@ def _require_project_filters()+def _require_project_effect_status(+ root: ET.Element,+ svg_path: Path | str,+) -> None:+ """Reject source effects that the importer cannot map without distortion."""+ errors = project_effect_status_errors(root)+ if not errors:+ return+ preview = '; '.join(errors[:8])+ suffix = '' if len(errors) <= 8 else f'; +{len(errors) - 8} more'+ raise SvgNativeConversionError(+ f'{Path(svg_path).name}: unsupported imported PPTX effect(s): '+ f'{preview}{suffix}'+ )++def _require_project_text_properties(root: ET.Element,svg_path: Path | str,@@ -1417,6 +1434,7 @@ def convert_svg_to_slide_shapes(_require_project_definitions(root, svg_path)_require_project_paint_references(root, svg_path)_require_project_gradients(root, svg_path)+ _require_project_effect_status(root, svg_path)_require_project_filters(root, svg_path)_require_project_image_aspect_ratios(root, svg_path)_require_project_transforms(root, svg_path)@@ -1488,6 +1506,7 @@ def convert_svg_to_slide_shapes(_require_project_definitions(root, svg_path)_require_project_paint_references(root, svg_path)_require_project_gradients(root, svg_path)+ _require_project_effect_status(root, svg_path)_require_project_filters(root, svg_path)_require_project_image_aspect_ratios(root, svg_path)_require_project_transforms(root, svg_path)diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.pyindex 9208a6cf..525b2e9e 100644--- a/skills/ppt-master/scripts/test_svg_quality_checker.py+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py@@ -16,6 +16,7 @@ from unittest.mock import patchfrom xml.etree import ElementTree as ETfrom pptx import Presentation+from pptx.enum.shapes import MSO_SHAPEfrom pptx.util import EmuSCRIPT_DIR = Path(__file__).resolve().parent@@ -36,6 +37,7 @@ from pptx_to_svg.preset_authoring import (validate_authored_preset_tree,)from pptx_to_svg.emu_units import Xfrm+from pptx_to_svg.effect_to_svg import convert_effectsfrom pptx_to_svg.preset_registry_to_svg import render_preset_geometryfrom pptx_to_svg.preset_svg_markup import serialize_preset_layersfrom pptx_to_svg.converter import ConvertOptions, convert_pptx_to_svg@@ -86,6 +88,7 @@ from template_import.manifest import (build_manifest,)from template_import.native_structure import build_native_structure+from pptx_effects import project_effect_status_errorsclass SVGQualityCheckerCompatibilityTests(unittest.TestCase):@@ -206,6 +209,64 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):target.writestr(info, replacements.get(info.filename, data))rewritten.replace(path)+ @staticmethod+ def _write_effect_fixture(path: Path, effects: list[str]) -> None:+ """Write one real slide per supplied shape-level effect container."""+ presentation = Presentation()+ blank = presentation.slide_layouts[6]+ for index, _effect in enumerate(effects, start=1):+ slide = presentation.slides.add_slide(blank)+ shape = slide.shapes.add_shape(+ MSO_SHAPE.CUBE,+ Emu(914400),+ Emu(914400),+ Emu(2743200),+ Emu(1828800),+ )+ shape.name = f'EFFECT TARGET {index}'+ presentation.save(path)++ pml = 'http://schemas.openxmlformats.org/presentationml/2006/main'+ dml = 'http://schemas.openxmlformats.org/drawingml/2006/main'+ with zipfile.ZipFile(path, 'r') as source:+ members = [(info, source.read(info.filename)) for info in source.infolist()]+ replacements: dict[str, bytes] = {}+ member_data = {info.filename: data for info, data in members}+ for index, effect_xml in enumerate(effects, start=1):+ slide_part = f'ppt/slides/slide{index}.xml'+ slide_root = ET.fromstring(member_data[slide_part])+ target = next(+ shape+ for shape in slide_root.findall(f'.//{{{pml}}}sp')+ if (+ shape.find(f'{{{pml}}}nvSpPr/{{{pml}}}cNvPr')+ is not None+ and shape.find(+ f'{{{pml}}}nvSpPr/{{{pml}}}cNvPr'+ ).get('name') == f'EFFECT TARGET {index}'+ )+ )+ sp_pr = target.find(f'{{{pml}}}spPr')+ assert sp_pr is not None+ for child in list(sp_pr):+ if child.tag in {+ f'{{{dml}}}effectLst',+ f'{{{dml}}}effectDag',+ }:+ sp_pr.remove(child)+ sp_pr.append(ET.fromstring(effect_xml))+ replacements[slide_part] = ET.tostring(+ slide_root,+ encoding='utf-8',+ xml_declaration=True,+ )++ rewritten = path.with_name(f'{path.stem}-rewritten.pptx')+ with zipfile.ZipFile(rewritten, 'w') as target:+ for info, data in members:+ target.writestr(info, replacements.get(info.filename, data))+ rewritten.replace(path)+@staticmethoddef _text_bound_warnings(result: dict) -> list[str]:return [@@ -2076,6 +2137,315 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):for error in project_filter_errors(ordinary)))+ def test_pptx_effect_import_is_closed_and_fail_closed(self):+ dml = 'http://schemas.openxmlformats.org/drawingml/2006/main'++ def effect_result(container: str):+ sp_pr = ET.fromstring(+ f'<p:spPr xmlns:p="http://schemas.openxmlformats.org/'+ f'presentationml/2006/main" xmlns:a="{dml}">'+ f'{container}</p:spPr>'+ )+ return convert_effects(sp_pr, None)++ outer = effect_result(f'''<a:effectLst xmlns:a="{dml}">+ <a:outerShdw blurRad="38100" dist="38100" dir="5400000">+ <a:srgbClr val="000000"><a:alpha val="50000"/></a:srgbClr>+ </a:outerShdw>+</a:effectLst>''')+ self.assertIsNotNone(outer.filter_id)+ self.assertEqual(dict(outer.metadata), {})+ self.assertIn('stdDeviation="2"', ''.join(outer.defs))++ glow = effect_result(f'''<a:effectLst xmlns:a="{dml}">+ <a:glow rad="95250"><a:srgbClr val="2563EB"/></a:glow>+</a:effectLst>''')+ glow_def = ''.join(glow.defs)+ self.assertIn('stdDeviation="10"', glow_def)+ self.assertNotIn('feMorphology', glow_def)++ high_saturation = effect_result(f'''<a:effectLst xmlns:a="{dml}">+ <a:glow rad="95250"><a:srgbClr val="2563EB">+ <a:satMod val="175000"/>+ </a:srgbClr></a:glow>+</a:effectLst>''')+ self.assertIsNotNone(high_saturation.filter_id)+ self.assertEqual(dict(high_saturation.metadata), {})++ unsupported_cases = {+ 'innerShdw': (+ f'<a:effectLst xmlns:a="{dml}"><a:innerShdw '+ 'blurRad="38100" dist="38100" dir="5400000">'+ '<a:srgbClr val="000000"/></a:innerShdw></a:effectLst>'+ ),+ 'blur': (+ f'<a:effectLst xmlns:a="{dml}"><a:blur rad="38100"/>'+ '</a:effectLst>'+ ),+ 'softEdge': (+ f'<a:effectLst xmlns:a="{dml}"><a:softEdge rad="38100"/>'+ '</a:effectLst>'+ ),+ 'reflection': (+ f'<a:effectLst xmlns:a="{dml}"><a:reflection blurRad="0"/>'+ '</a:effectLst>'+ ),+ }+ for effect_name, container in unsupported_cases.items():+ with self.subTest(effect=effect_name):+ result = effect_result(container)+ self.assertIsNone(result.filter_id)+ self.assertEqual(result.defs, ())+ self.assertEqual(+ dict(result.metadata)['data-pptx-effect-reason'],+ f'unsupported-effect:{effect_name}',+ )++ zero_offset = effect_result(+ f'<a:effectLst xmlns:a="{dml}"><a:outerShdw '+ 'blurRad="38100" dist="0" dir="0">'+ '<a:srgbClr val="000000"/></a:outerShdw></a:effectLst>'+ )+ self.assertIn(+ 'offset-is-not-classifiable',+ dict(zero_offset.metadata)['data-pptx-effect-reason'],+ )+ invalid_glow = effect_result(+ f'<a:effectLst xmlns:a="{dml}"><a:glow rad="1.5"/>'+ '</a:effectLst>'+ )+ self.assertIn(+ "rad='1.5'",+ dict(invalid_glow.metadata)['data-pptx-effect-reason'],+ )+ multiple = effect_result(+ f'<a:effectLst xmlns:a="{dml}"><a:outerShdw dist="38100"/>'+ '<a:reflection/></a:effectLst>'+ )+ self.assertEqual(+ dict(multiple.metadata)['data-pptx-effect-reason'],+ 'multiple-effects:outerShdw,reflection',+ )+ effect_dag = effect_result(f'<a:effectDag xmlns:a="{dml}"/>')+ self.assertEqual(+ dict(effect_dag.metadata)['data-pptx-effect-reason'],+ 'unsupported-effect-container:effectDag',+ )++ invalid_subset_cases = {+ 'duplicate containers': ((+ f'<a:effectLst xmlns:a="{dml}"/>'+ f'<a:effectLst xmlns:a="{dml}"/>'+ ), 'multiple-effect-containers'),+ 'foreign container namespace': ((+ '<x:effectLst xmlns:x="urn:foreign"/>'+ ), 'invalid-effect-container-namespace'),+ 'foreign effect namespace': ((+ f'<a:effectLst xmlns:a="{dml}" xmlns:x="urn:foreign">'+ '<x:outerShdw/></a:effectLst>'+ ), 'invalid-effect-namespace'),+ 'missing color': ((+ f'<a:effectLst xmlns:a="{dml}"><a:outerShdw '+ 'dist="38100"/></a:effectLst>'+ ), 'missing-color'),+ 'invalid srgb color': ((+ f'<a:effectLst xmlns:a="{dml}"><a:outerShdw '+ 'dist="38100"><a:srgbClr val="bogus"/>'+ '</a:outerShdw></a:effectLst>'+ ), 'invalid-color:srgbClr'),+ 'multiple colors': ((+ f'<a:effectLst xmlns:a="{dml}"><a:outerShdw '+ 'dist="38100"><a:srgbClr val="000000"/>'+ '<a:srgbClr val="FFFFFF"/></a:outerShdw></a:effectLst>'+ ), 'multiple-colors'),+ 'invalid alpha': ((+ f'<a:effectLst xmlns:a="{dml}"><a:glow rad="38100">'+ '<a:srgbClr val="000000"><a:alpha val="bad"/>'+ '</a:srgbClr></a:glow></a:effectLst>'+ ), 'invalid-alpha-val'),+ 'unsupported color modifier': ((+ f'<a:effectLst xmlns:a="{dml}"><a:glow rad="38100">'+ '<a:srgbClr val="000000"><a:gamma/>'+ '</a:srgbClr></a:glow></a:effectLst>'+ ), 'unsupported-color-modifier:gamma'),+ 'oversized distance': ((+ f'<a:effectLst xmlns:a="{dml}"><a:outerShdw '+ f'dist="{"9" * 400}"><a:srgbClr val="000000"/>'+ '</a:outerShdw></a:effectLst>'+ ), 'dist='),+ 'oversized radius': ((+ f'<a:effectLst xmlns:a="{dml}"><a:glow '+ f'rad="{"9" * 400}"><a:srgbClr val="000000"/>'+ '</a:glow></a:effectLst>'+ ), 'rad='),+ 'oversized direction': ((+ f'<a:effectLst xmlns:a="{dml}"><a:outerShdw '+ f'dist="38100" dir="{"9" * 400}">'+ '<a:srgbClr val="000000"/></a:outerShdw></a:effectLst>'+ ), 'dir='),+ }+ for case_name, (container, expected_reason) in invalid_subset_cases.items():+ with self.subTest(case=case_name):+ result = effect_result(container)+ self.assertIsNone(result.filter_id)+ self.assertEqual(result.defs, ())+ self.assertIn(+ expected_reason,+ dict(result.metadata)['data-pptx-effect-reason'],+ )++ def round_trip_supported(result):+ filter_id = result.filter_id+ svg = (+ '<svg xmlns="http://www.w3.org/2000/svg" '+ 'viewBox="0 0 1280 720"><defs>'+ + ''.join(result.defs)+ + f'</defs><rect x="10" y="10" width="100" height="60" '+ f'fill="#FFFFFF" filter="url(#{filter_id})"/></svg>'+ )+ with tempfile.TemporaryDirectory() as tmp_dir:+ svg_path = Path(tmp_dir) / 'tiny-effect.svg'+ svg_path.write_text(svg, encoding='utf-8')+ output, *_rest = convert_svg_to_slide_shapes(svg_path)+ return output++ tiny_outer = effect_result(+ f'<a:effectLst xmlns:a="{dml}"><a:outerShdw '+ 'blurRad="1" dist="100" dir="0">'+ '<a:srgbClr val="000000"/></a:outerShdw></a:effectLst>'+ )+ tiny_outer_xml = round_trip_supported(tiny_outer)+ self.assertIn('<a:outerShdw blurRad="1" dist="100"', tiny_outer_xml)+ self.assertNotIn('<a:glow', tiny_outer_xml)++ tiny_glow = effect_result(+ f'<a:effectLst xmlns:a="{dml}"><a:glow rad="1">'+ '<a:srgbClr val="000000"/></a:glow></a:effectLst>'+ )+ self.assertIn('<a:glow rad="1">', round_trip_supported(tiny_glow))++ marked_svg = '''<svg xmlns="http://www.w3.org/2000/svg"+ viewBox="0 0 1280 720">+ <rect x="80" y="80" width="300" height="180" fill="#FFFFFF"+ data-pptx-effect-status="unsupported"+ data-pptx-effect-reason="unsupported-effect:reflection"/>+</svg>'''+ self._assert_checker_and_exporter_reject(+ marked_svg,+ 'unsupported source PPTX effect: unsupported-effect:reflection',+ 'unsupported imported PPTX effect',+ )++ def test_real_pptx_effect_import_matrix(self):+ dml = 'http://schemas.openxmlformats.org/drawingml/2006/main'+ containers = [+ f'''<a:effectLst xmlns:a="{dml}">+ <a:outerShdw blurRad="38100" dist="38100" dir="5400000">+ <a:srgbClr val="000000"><a:alpha val="50000"/></a:srgbClr>+ </a:outerShdw>+</a:effectLst>''',+ f'''<a:effectLst xmlns:a="{dml}">+ <a:glow rad="95250"><a:srgbClr val="2563EB"/></a:glow>+</a:effectLst>''',+ f'''<a:effectLst xmlns:a="{dml}"><a:innerShdw+ blurRad="38100" dist="38100" dir="5400000"><a:srgbClr val="000000"/>+</a:innerShdw></a:effectLst>''',+ f'<a:effectLst xmlns:a="{dml}"><a:blur rad="38100"/></a:effectLst>',+ f'<a:effectLst xmlns:a="{dml}"><a:softEdge rad="38100"/></a:effectLst>',+ f'<a:effectLst xmlns:a="{dml}"><a:reflection/></a:effectLst>',+ f'''<a:effectLst xmlns:a="{dml}"><a:outerShdw+ blurRad="38100" dist="0" dir="0"><a:srgbClr val="000000"/>+</a:outerShdw></a:effectLst>''',+ f'''<a:effectLst xmlns:a="{dml}">+ <a:outerShdw blurRad="38100" dist="38100" dir="5400000">+ <a:srgbClr val="000000"/>+ </a:outerShdw><a:reflection/>+</a:effectLst>''',+ f'<a:effectDag xmlns:a="{dml}"/>',+ ]+ with tempfile.TemporaryDirectory() as tmp_dir:+ root_dir = Path(tmp_dir)+ pptx_path = root_dir / 'effects.pptx'+ self._write_effect_fixture(pptx_path, containers)+ imported = convert_pptx_to_svg(+ pptx_path,+ options=ConvertOptions(inheritance_mode='flat'),+ )+ self.assertEqual(len(imported.slides), len(containers))++ outer_svg = imported.slides[0].svg+ outer_root = ET.fromstring(outer_svg)+ self.assertEqual(project_effect_status_errors(outer_root), [])+ self.assertEqual(project_filter_errors(outer_root), [])+ outer_path = root_dir / 'outer.svg'+ outer_path.write_text(outer_svg, encoding='utf-8')+ outer_xml, *_rest = convert_svg_to_slide_shapes(outer_path)+ self.assertEqual(outer_xml.count('<a:outerShdw'), 1)++ glow_svg = imported.slides[1].svg+ glow_root = ET.fromstring(glow_svg)+ self.assertEqual(project_effect_status_errors(glow_root), [])+ self.assertEqual(project_filter_errors(glow_root), [])+ self.assertNotIn('feMorphology', glow_svg)+ self.assertIn('stdDeviation="10"', glow_svg)+ glow_path = root_dir / 'glow.svg'+ glow_path.write_text(glow_svg, encoding='utf-8')+ glow_xml, *_rest = convert_svg_to_slide_shapes(glow_path)+ self.assertIn('<a:glow rad="95250">', glow_xml)++ expected_reasons = (+ 'unsupported-effect:innerShdw',+ 'unsupported-effect:blur',+ 'unsupported-effect:softEdge',+ 'unsupported-effect:reflection',+ 'offset-is-not-classifiable',+ 'multiple-effects:outerShdw,reflection',+ 'unsupported-effect-container:effectDag',+ )+ for artifact, expected_reason in zip(+ imported.slides[2:],+ expected_reasons,+ ):+ with self.subTest(reason=expected_reason):+ artifact_root = ET.fromstring(artifact.svg)+ status_errors = project_effect_status_errors(artifact_root)+ self.assertEqual(len(status_errors), 1)+ self.assertTrue(any(+ expected_reason in error+ for error in status_errors+ ))+ marked = [+ elem+ for elem in artifact_root.iter()+ if elem.get('data-pptx-effect-status') == 'unsupported'+ ]+ self.assertEqual(len(marked), 2)+ self.assertEqual(+ {elem.get('data-pptx-effect-reason') for elem in marked},+ {next(+ elem.get('data-pptx-effect-reason')+ for elem in marked+ )},+ )+ self.assertTrue(any(+ elem.get('data-pptx-object') == 'shape'+ and elem.get('data-pptx-prst') == 'cube'+ for elem in marked+ ))+ self.assertTrue(any(+ elem.get('data-pptx-part') == 'geometry'+ and elem.get('data-pptx-prst') == 'cube'+ for elem in marked+ ))+ self.assertNotIn('<filter', artifact.svg)+ artifact_path = root_dir / f'unsupported-{artifact.index}.svg'+ artifact_path.write_text(artifact.svg, encoding='utf-8')+ with self.assertRaisesRegex(+ SvgNativeConversionError,+ 'unsupported imported PPTX effect',+ ):+ convert_svg_to_slide_shapes(artifact_path)+def test_missing_paint_reference_blocks_checker_and_exporter(self):self._assert_checker_and_exporter_reject('''<svg xmlns="http://www.w3.org/2000/svg"