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): block inherited text effect loss
hugohe3808dd12e355f
diff --git a/docs/powerpoint-svg-mapping.md b/docs/powerpoint-svg-mapping.mdindex a806bae3..d24bd3ca 100644--- a/docs/powerpoint-svg-mapping.md+++ b/docs/powerpoint-svg-mapping.md@@ -160,7 +160,7 @@ preset selection and authoring behavior are documented in| 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`; one imported shape/connector 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 shape/connector source glow keeps the registered radius conversion | Review when the glow carries semantic emphasis |-| Imported text-run effect | Unchanged `metadata[data-pptx-part="txbody"]` on a logical shape; import-only blocking effect status for vertical, relationship-bearing, and table-cell fallback routes | Original native run effect inside `p:txBody` | `Native-stable` only while the raw payload remains usable; edits or fallback routes that would drop a non-empty run `effectLst` / `effectDag` block | Not public authoring syntax; a table-cell run effect also disables the native Table replacement payload |+| Imported text-run effect | Unchanged `metadata[data-pptx-part="txbody"]` on a logical shape; import-only blocking effect status for inherited Layout/Master list styles plus vertical, relationship-bearing, and table-cell fallback routes | Original slide-local native run effect inside `p:txBody` | `Native-stable` only while the raw slide-local payload remains usable; inherited effects, edits, or fallback routes that would drop a non-empty run `effectLst` / `effectDag` block | Not public authoring syntax; a table-cell run effect also disables the native Table replacement payload || 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`; PPTX import keeps the base object and emits blocking diagnostics for unsupported shape/connector effects, picture/group effect DAGs, and non-empty picture/group effect lists | Handled object effects cannot be reclassified or omitted; text-run safety follows the unchanged-`txBody` row above |diff --git a/docs/zh/powerpoint-svg-mapping.md b/docs/zh/powerpoint-svg-mapping.mdindex 5d458f8a..1bb08719 100644--- a/docs/zh/powerpoint-svg-mapping.md+++ b/docs/zh/powerpoint-svg-mapping.md@@ -155,7 +155,7 @@ PowerPoint 意图| 线条箭头 | 已登记起点/终点 marker | 原生 head/tail end 属性 | marker 大小为 `Approximate` | 见条件 marker 合同 || 外阴影 | 一个受支持 shadow filter 图 | `a:effectLst` 中的原生外阴影 | `Approximate`;仅当非零偏移仍可稳定分类时,才重建单一 shape/connector 来源 `outerShdw` | 零偏移来源阴影和不支持的图结构不会被静默改成其他效果 || 发光 | 一个受支持 glow filter 图 | `a:effectLst` 中的原生发光 | `Approximate`;单一 shape/connector 来源发光保持已登记的半径换算 | 发光承载语义强调时需复核 |-| 导入的文字 run 效果 | 逻辑 shape 上未变更的 `metadata[data-pptx-part="txbody"]`;竖排、含关系引用及表格单元格降级路径使用仅限导入的阻塞效果状态 | `p:txBody` 内原始原生 run 效果 | 仅在原始 payload 仍可用时为 `Native-stable`;会丢失非空 run `effectLst` / `effectDag` 的编辑或降级路径将被阻断 | 不是公开创作语法;表格单元格 run 效果还会禁用原生 Table 替换 payload |+| 导入的文字 run 效果 | 逻辑 shape 上未变更的 `metadata[data-pptx-part="txbody"]`;继承自 Layout/Master 的列表样式以及竖排、含关系引用、表格单元格降级路径使用仅限导入的阻塞效果状态 | `p:txBody` 内原始的 slide-local 原生 run 效果 | 仅在原始 slide-local payload 仍可用时为 `Native-stable`;继承效果、编辑或降级路径若会丢失非空 run `effectLst` / `effectDag` 则被阻断 | 不是公开创作语法;表格单元格 run 效果还会禁用原生 Table 替换 payload || 整个对象透明度 | 原子元素 `opacity` | alpha 分发至受支持原生通道 | `Native-normalized` | 除非整个原子对象需要淡出,否则优先通道专属 alpha || 组透明度 | 兼容 `<g opacity>` | 后代归一化近似 | `Approximate`,并产生 warning | 生成 SVG 应优先后代 alpha || 内阴影、柔化边缘、倒影、模糊、湍流、混合模式或任意 mask | 无已登记原生映射 | 显式几何替代或栅格资产 | `Bake-required`;PPTX 回导保留基础对象,并对不支持的 shape/connector 效果、图片/组效果 DAG 及非空图片/组效果列表产生阻塞诊断 | 已处理的对象效果不能被改成其他类型或静默省略;文字 run 安全边界见上方未变更 `txBody` 行 |diff --git a/skills/ppt-master/references/shared-standards.md b/skills/ppt-master/references/shared-standards.mdindex 8b07a8b2..fd0ab3b8 100644--- a/skills/ppt-master/references/shared-standards.md+++ b/skills/ppt-master/references/shared-standards.md@@ -788,21 +788,27 @@ Picture and group targets do not expose the public filter mapping: any sourceeffect DAG or non-empty effect list on `p:pic/p:spPr` or `p:grpSp/p:grpSpPr`keeps the base object but receives effect-status metadata instead of attachingan invalid filter to `<image>` or ordinary `<g>`.-Imported metadata-backed logical shapes preserve run-level effects only inside an-unchanged `metadata[data-pptx-part="txbody"]` payload. If visible text,-typography, or child topology invalidates that payload, checker and exporter-stop when the source `rPr` / `defRPr` / `endParaRPr` contains a non-empty-`effectLst` or `effectDag`; effect-free edited text keeps the normal fallback.+Imported metadata-backed logical shapes preserve slide-local run-level effects+only inside an unchanged `metadata[data-pptx-part="txbody"]` payload. If+visible text, typography, or child topology invalidates that payload, checker+and exporter stop when the source `rPr` / `defRPr` / `endParaRPr` contains a+non-empty `effectLst` or `effectDag`; effect-free edited text keeps the normal+fallback.+Effects found in the inherited Layout/Master list-style chain are outside that+slide-local payload. Horizontal import keeps the visible fallback and payload+but stamps the logical shape and native carrier with+`unsupported-run-effect-route:inherited-text-style`.The separate vertical-text output cannot carry that payload. When its source-text body contains the same non-empty run-effect containers, import keeps the-normalized geometry and visible vertical text but stamps the logical shape and-native carrier with the blocking §1.4 effect status; effect-free and empty-effect containers keep the existing normalized fallback.-Relationship-bearing text bodies also cannot carry the opaque payload across-parts. When such a body contains a non-empty run effect, import keeps its-rebuilt visible text but stamps the same two blocking object markers;-relationship-bearing text without a run effect keeps the existing visual+text body or inherited list-style chain contains the same non-empty run-effect+containers, import keeps the normalized geometry and visible vertical text but+stamps the logical shape and native carrier with the blocking §1.4 effect+status; effect-free and empty effect containers keep the existing normalizedfallback.+Relationship-bearing text bodies also cannot carry the opaque payload across+parts. When such a body or its inherited list-style chain contains a non-empty+run effect, import keeps its rebuilt visible text but stamps the same two+blocking object markers; relationship-bearing text without a run effect keeps+the existing visual fallback.Table-cell text bodies use neither the opaque payload nor the public filtermapping. A non-empty run effect disables the native Table replacement payload,keeps the visible table fallback, and stamps its imported `p:graphicFrame`@@ -1343,12 +1349,14 @@ rebuild its effect with supported explicit geometry; baking the effect-lessanalysis SVG alone cannot recover the source appearance. This diagnostic pathcovers `p:sp`, `p:cxnSp`, `p:pic`, and `p:grpSp` source effects. Text-run sourceeffects follow the route-specific §6.4 contract: unchanged metadata-backed-horizontal text preserves its native `txBody`, while a lossy edit blocks from-that payload; vertical and relationship-bearing shape-text routes keep their-visible fallback and stamp the logical shape plus carrier with effect-status;-table-cell text keeps the visible table fallback, disables native Table replacement,-and stamps the imported `p:graphicFrame` group. Handled object or text-run-effects must never become a different effect or disappear without a diagnostic.+horizontal text preserves slide-local effects in its native `txBody`, while a+lossy edit blocks from that payload and inherited list-style effects receive a+separate blocking marker; vertical and relationship-bearing shape-text routes+keep their visible fallback and stamp the logical shape plus carrier with+effect-status; table-cell text keeps the visible table fallback, disables+native Table replacement, and stamps the imported `p:graphicFrame` group.+Handled object or text-run effects must never become a different effect or+disappear without a diagnostic.---diff --git a/skills/ppt-master/scripts/pptx_effects.py b/skills/ppt-master/scripts/pptx_effects.pyindex 25b4e0c1..d2415a80 100644--- a/skills/ppt-master/scripts/pptx_effects.py+++ b/skills/ppt-master/scripts/pptx_effects.py@@ -78,19 +78,20 @@ def unsupported_effect_metadata(reason: str) -> dict[str, str]:}-def txbody_has_run_effects(txbody: ET.Element | None) -> bool:- """Return whether rebuilding a text body would discard a run effect."""- if txbody is None:- return False- for properties in txbody.iter():- if properties.tag not in _TEXT_PROPERTY_TAGS:+def txbody_has_run_effects(*text_style_roots: ET.Element | None) -> bool:+ """Return whether rebuilding any supplied text style would lose an effect."""+ for root in text_style_roots:+ if root is None:continue- for child in properties:- if child.tag in _RUN_EFFECT_CONTAINER_TAGS and any(- isinstance(effect.tag, str)- for effect in child- ):- return True+ for properties in root.iter():+ if properties.tag not in _TEXT_PROPERTY_TAGS:+ continue+ for child in properties:+ if child.tag in _RUN_EFFECT_CONTAINER_TAGS and any(+ isinstance(effect.tag, str)+ for effect in child+ ):+ return Truereturn Falsediff --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 7f560199..068f19ca 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@@ -346,7 +346,11 @@ def _convert_shape(node: ShapeNode, ctx: AssemblyContext, *, top_level: bool) -># Text body (a:txBody)tx_body = node.xml.find("p:txBody", NS)is_vertical = is_vertical_txbody(tx_body, node.xfrm)- has_run_effects = txbody_has_run_effects(tx_body)+ local_has_run_effects = txbody_has_run_effects(tx_body)+ inherited_has_run_effects = txbody_has_run_effects(+ *node.inherited_lst_styles+ )+ has_run_effects = local_has_run_effects or inherited_has_run_effectsif geom is not None and has_run_effects:if is_vertical:geom.attrs.update(unsupported_effect_metadata(@@ -356,6 +360,10 @@ def _convert_shape(node: ShapeNode, ctx: AssemblyContext, *, top_level: bool) ->geom.attrs.update(unsupported_effect_metadata("unsupported-run-effect-route:relationship-bearing-text"))+ elif inherited_has_run_effects:+ geom.attrs.update(unsupported_effect_metadata(+ "unsupported-run-effect-route:inherited-text-style"+ ))# Geometry (fill is "none" when blipFill is present, so only stroke draws)geom_xml = _build_geometry_xml(node, sp_pr, ctx, geom=geom)diff --git a/skills/ppt-master/scripts/test_svg_quality_checker.py b/skills/ppt-master/scripts/test_svg_quality_checker.pyindex a1d10b9a..670f6b74 100644--- a/skills/ppt-master/scripts/test_svg_quality_checker.py+++ b/skills/ppt-master/scripts/test_svg_quality_checker.py@@ -236,6 +236,7 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):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] = {}@@ -416,6 +417,89 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):target.writestr(info, replacements.get(info.filename, data))rewritten.replace(path)+ @staticmethod+ def _write_inherited_run_effect_fixture(path: Path) -> None:+ """Write placeholder text that inherits one run effect from its layout."""+ presentation = Presentation()+ layout = presentation.slide_layouts[1]+ layout_part = str(layout.part.partname).lstrip('/')+ slide_parts: list[str] = []+ for index in range(1, 4):+ slide = presentation.slides.add_slide(layout)+ slide_parts.append(str(slide.part.partname).lstrip('/'))+ body = slide.placeholders[1]+ body.text = f'INHERITED EFFECT {index}'+ if index == 3:+ body.text_frame.paragraphs[0].runs[0].hyperlink.address = (+ 'https://example.com/'+ )+ presentation.save(path)++ pml = 'http://schemas.openxmlformats.org/presentationml/2006/main'+ dml = 'http://schemas.openxmlformats.org/drawingml/2006/main'++ def body_placeholder(+ root: ET.Element,+ ) -> tuple[ET.Element, ET.Element]:+ placeholder_path = (+ f'{{{pml}}}nvSpPr/{{{pml}}}nvPr/{{{pml}}}ph'+ )+ for shape in root.findall(f'.//{{{pml}}}sp'):+ placeholder = shape.find(placeholder_path)+ if placeholder is not None and placeholder.get('idx') == '1':+ return shape, placeholder+ raise AssertionError('content placeholder idx=1 not found')++ with zipfile.ZipFile(path, 'r') as source:+ members = [+ (info, source.read(info.filename))+ for info in source.infolist()+ ]+ member_data = {info.filename: data for info, data in members}+ replacements: dict[str, bytes] = {}++ layout_root = ET.fromstring(member_data[layout_part])+ layout_placeholder, layout_placeholder_properties = body_placeholder(+ layout_root+ )+ layout_placeholder_properties.set('type', 'body')+ list_style = layout_placeholder.find(+ f'{{{pml}}}txBody/{{{dml}}}lstStyle'+ )+ assert list_style is not None+ level_properties = ET.SubElement(list_style, f'{{{dml}}}lvl1pPr')+ default_properties = ET.SubElement(+ level_properties,+ f'{{{dml}}}defRPr',+ )+ default_properties.append(ET.fromstring(f'''<a:effectLst xmlns:a="{dml}">+ <a:glow rad="38100"><a:srgbClr val="2563EB"/></a:glow>+</a:effectLst>'''))+ replacements[layout_part] = ET.tostring(+ layout_root,+ encoding='utf-8',+ xml_declaration=True,+ )++ vertical_root = ET.fromstring(member_data[slide_parts[1]])+ vertical_placeholder, _ = body_placeholder(vertical_root)+ body_properties = vertical_placeholder.find(+ f'{{{pml}}}txBody/{{{dml}}}bodyPr'+ )+ assert body_properties is not None+ body_properties.set('vert', 'eaVert')+ replacements[slide_parts[1]] = ET.tostring(+ vertical_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 _write_table_run_effect_fixture(path: Path,@@ -3139,6 +3223,73 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):native_xml = convert_svg_to_slide_shapes(native_path)[0]self.assertEqual(native_xml.count('<a:glow'), 1)+ def test_inherited_text_run_effect_import_fails_closed(self):+ expected_reasons = {+ 1: 'unsupported-run-effect-route:inherited-text-style',+ 2: 'unsupported-run-effect-route:vertical-text',+ 3: 'unsupported-run-effect-route:relationship-bearing-text',+ }+ with tempfile.TemporaryDirectory() as tmp_dir:+ root_dir = Path(tmp_dir)+ pptx_path = root_dir / 'inherited-run-effects.pptx'+ self._write_inherited_run_effect_fixture(pptx_path)+ imported = convert_pptx_to_svg(+ pptx_path,+ options=ConvertOptions(inheritance_mode='flat'),+ )+ self.assertEqual(len(imported.slides), 3)++ for artifact in imported.slides:+ with self.subTest(slide=artifact.index):+ reason = expected_reasons[artifact.index]+ root = ET.fromstring(artifact.svg)+ self.assertIn(+ f'INHERITED EFFECT {artifact.index}',+ ''.join(root.itertext()),+ )+ self.assertEqual(project_filter_errors(root), [])+ marked = [+ elem+ for elem in 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+ },+ {reason},+ )+ logical_shape = next(+ elem+ for elem in marked+ if elem.tag.rsplit('}', 1)[-1] == 'g'+ )+ status_errors = project_effect_status_errors(root)+ self.assertEqual(len(status_errors), 1)+ self.assertIn(reason, status_errors[0])++ metadata = [+ elem+ for elem in logical_shape.iter()+ if elem.get('data-pptx-part') == 'txbody'+ ]+ if artifact.index == 1:+ self.assertEqual(len(metadata), 1)+ payload = base64.b64decode(+ (metadata[0].text or '').strip()+ ).decode('utf-8')+ self.assertNotIn('<a:effectLst', payload)+ else:+ self.assertEqual(metadata, [])++ self._assert_checker_and_exporter_reject(+ artifact.svg,+ reason,+ 'unsupported imported PPTX effect',+ )+def test_table_cell_run_effect_import_fails_closed(self):cases = [('rPr:effectLst', False),@@ -5052,10 +5203,13 @@ class SVGQualityCheckerCompatibilityTests(unittest.TestCase):'<a:p><a:r><a:rPr><a:effectLst/><a:effectDag/></a:rPr>''<a:t>AB</a:t></a:r></a:p>')+ local_text = txbody('<a:p><a:r><a:t>AB</a:t></a:r></a:p>')self.assertTrue(txbody_has_run_effects(inherited_list))self.assertTrue(txbody_has_run_effects(paragraph_end_dag))self.assertFalse(txbody_has_run_effects(empty_containers))+ self.assertTrue(txbody_has_run_effects(local_text, inherited_list))+ self.assertFalse(txbody_has_run_effects(local_text, empty_containers))def test_checker_does_not_trust_authored_runtime_txbody_snapshot(self):root = ET.fromstring(