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(convert): surface the four remaining swallowed failures
hugohe380a403b55b91
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 581ebc8f..23be583f 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@@ -598,6 +598,8 @@ def _convert_shape(node: ShapeNode, ctx: AssemblyContext, *, top_level: bool) ->action,),inline_formula_resolver=inline_formula_resolver,+ strict=ctx.strict,+ diagnostic_sink=ctx.diagnose,)else:text_result = convert_txbody(@@ -615,6 +617,8 @@ def _convert_shape(node: ShapeNode, ctx: AssemblyContext, *, top_level: bool) ->action,),inline_formula_resolver=inline_formula_resolver,+ strict=ctx.strict,+ diagnostic_sink=ctx.diagnose,) if tx_body is not None else TextResult()except ValueError as exc:if ctx.strict:@@ -1511,6 +1515,8 @@ def _render_graphic_table(rid,action,),+ strict=ctx.strict,+ diagnostic_sink=ctx.diagnose,)if result.defs:ctx.defs.extend(result.defs)@@ -1738,16 +1744,36 @@ def _theme_background_fill(bg_ref: ET.Element,) -> ET.Element | None:"""Resolve p:bgRef idx into the theme background fill style list."""+ def reject_invalid_idx(message: str) -> None:+ if ctx.strict:+ raise ValueError(message)+ ctx.diagnose(+ "theme-background-reference-omitted",+ message,+ "omit this part's theme background fill",+ )+idx_raw = bg_ref.attrib.get("idx")if not idx_raw:+ reject_invalid_idx(+ "Invalid p:bgRef@idx: expected a 1001-based theme fill index"+ )return Nonetry:idx = int(idx_raw)except ValueError:+ reject_invalid_idx(+ f"Invalid p:bgRef@idx value {idx_raw!r}; expected a 1001-based "+ "theme fill index"+ )return None# ECMA style matrix background fill references are 1001-based.bg_fill_index = idx - 1001if bg_fill_index < 0:+ reject_invalid_idx(+ f"Invalid p:bgRef@idx value {idx_raw!r}; expected a value of 1001 "+ "or greater"+ )return Nonetheme = ctx.pkg.resolve_theme(slide.master)@@ -1758,6 +1784,10 @@ def _theme_background_fill(return Nonefills = [child for child in list(fill_list) if isinstance(child.tag, str)]if bg_fill_index >= len(fills):+ reject_invalid_idx(+ f"Invalid p:bgRef@idx value {idx_raw!r}; theme background fill list "+ f"contains {len(fills)} entries"+ )return Nonereturn fills[bg_fill_index]diff --git a/skills/ppt-master/scripts/pptx_to_svg/tbl_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/tbl_to_svg.pyindex 8cff3da6..3b6430e7 100644--- a/skills/ppt-master/scripts/pptx_to_svg/tbl_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/tbl_to_svg.py@@ -55,8 +55,13 @@ from .emu_units import ()from .fill_to_svg import FillResult, resolve_fillfrom .ln_to_svg import resolve_stroke-from .txbody_to_svg import _resolve_theme_typeface, convert_txbody-from .txbody_to_svg import HyperlinkResolver+from .txbody_to_svg import (+ HyperlinkResolver,+ TextDiagnosticSink,+ TextImportError,+ _resolve_theme_typeface,+ convert_txbody,+)BUILTIN_MEDIUM_STYLE_2_ACCENT_1 = "{5C22544A-7EE6-4342-B048-85BDC9FD1C3A}"@@ -281,6 +286,8 @@ def convert_tbl(grad_seq: list[int] | None = None,marker_seq: list[int] | None = None,hyperlink_resolver: HyperlinkResolver | None = None,+ strict: bool = False,+ diagnostic_sink: TextDiagnosticSink | None = None,) -> TableResult:"""Render an <a:tbl> at the given absolute xfrm into SVG markup."""grad_seq = grad_seq if grad_seq is not None else [0]@@ -417,6 +424,8 @@ def convert_tbl(id_prefix=f"{id_prefix}txt",id_seq=grad_seq,hyperlink_resolver=hyperlink_resolver,+ strict=strict,+ diagnostic_sink=diagnostic_sink,)defs.extend(text_result.defs)if text_result.svg:@@ -1553,6 +1562,8 @@ def _convert_cell_text(id_prefix: str,id_seq: list[int] | None,hyperlink_resolver: HyperlinkResolver | None,+ strict: bool,+ diagnostic_sink: TextDiagnosticSink | None,):"""Render cell text. PowerPoint's <a:tcPr> can override txBody insets viaits own marL/marR/marT/marB attrs; convert_txbody reads from <a:bodyPr>,@@ -1607,7 +1618,11 @@ def _convert_cell_text(id_prefix=id_prefix,id_seq=id_seq,hyperlink_resolver=hyperlink_resolver,+ strict=strict,+ diagnostic_sink=diagnostic_sink,)+ except TextImportError:+ raiseexcept (AttributeError, OverflowError, TypeError, ValueError):plain_tx_body = _plain_table_text_body(render_tx_body, overrides)return convert_txbody(@@ -1617,6 +1632,8 @@ def _convert_cell_text(id_prefix=id_prefix,id_seq=id_seq,hyperlink_resolver=hyperlink_resolver,+ strict=strict,+ diagnostic_sink=diagnostic_sink,)finally:if overrides and body_pr is not None:diff --git a/skills/ppt-master/scripts/pptx_to_svg/txbody_to_svg.py b/skills/ppt-master/scripts/pptx_to_svg/txbody_to_svg.pyindex 75cf3e4f..d3d55c0d 100644--- a/skills/ppt-master/scripts/pptx_to_svg/txbody_to_svg.py+++ b/skills/ppt-master/scripts/pptx_to_svg/txbody_to_svg.py@@ -71,6 +71,11 @@ class TextRun:HyperlinkResolver = Callable[[str, str], str | None]InlineFormulaResolver = Callable[[ET.Element], tuple[str | None, str]]+TextDiagnosticSink = Callable[[str, str, str], None]+++class TextImportError(ValueError):+ """Report malformed DrawingML text in strict import mode."""@dataclass@@ -124,6 +129,8 @@ def convert_txbody(id_seq: list[int] | None = None,hyperlink_resolver: HyperlinkResolver | None = None,inline_formula_resolver: InlineFormulaResolver | None = None,+ strict: bool = False,+ diagnostic_sink: TextDiagnosticSink | None = None,) -> TextResult:"""Convert <p:txBody> under the given shape geometry to SVG <text>(s)."""if tx_body is None:@@ -138,6 +145,8 @@ def convert_txbody(slide_number=slide_number, id_prefix=id_prefix, id_seq=id_seq,hyperlink_resolver=hyperlink_resolver,inline_formula_resolver=inline_formula_resolver,+ strict=strict,+ diagnostic_sink=diagnostic_sink,)if not paragraphs or not _has_visible_text(paragraphs):return TextResult()@@ -243,6 +252,8 @@ def convert_vertical_txbody(id_seq: list[int] | None = None,hyperlink_resolver: HyperlinkResolver | None = None,inline_formula_resolver: InlineFormulaResolver | None = None,+ strict: bool = False,+ diagnostic_sink: TextDiagnosticSink | None = None,) -> TextResult:"""Render East Asian vertical text as upright stacked glyphs.@@ -262,6 +273,8 @@ def convert_vertical_txbody(slide_number=slide_number, id_prefix=id_prefix, id_seq=id_seq,hyperlink_resolver=hyperlink_resolver,inline_formula_resolver=inline_formula_resolver,+ strict=strict,+ diagnostic_sink=diagnostic_sink,)runs = [run@@ -401,6 +414,8 @@ def _parse_paragraphs(id_seq: list[int] | None = None,hyperlink_resolver: HyperlinkResolver | None = None,inline_formula_resolver: InlineFormulaResolver | None = None,+ strict: bool = False,+ diagnostic_sink: TextDiagnosticSink | None = None,) -> list[TextParagraph]:"""Walk <a:p> children producing TextParagraph objects."""paragraphs: list[TextParagraph] = []@@ -422,6 +437,8 @@ def _parse_paragraphs(id_prefix=id_prefix, id_seq=id_seq,hyperlink_resolver=hyperlink_resolver,inline_formula_resolver=inline_formula_resolver,+ strict=strict,+ diagnostic_sink=diagnostic_sink,)paragraphs.append(para)@@ -443,6 +460,8 @@ def _parse_paragraph(id_seq: list[int] | None = None,hyperlink_resolver: HyperlinkResolver | None = None,inline_formula_resolver: InlineFormulaResolver | None = None,+ strict: bool = False,+ diagnostic_sink: TextDiagnosticSink | None = None,) -> TextParagraph:para = TextParagraph()@@ -484,6 +503,8 @@ def _parse_paragraph(default_font_size_px=default_font_size_px,id_prefix=id_prefix, id_seq=id_seq,hyperlink_resolver=hyperlink_resolver,+ strict=strict,+ diagnostic_sink=diagnostic_sink,)for child in list(p_elem):@@ -564,6 +585,8 @@ def _build_run(id_prefix: str = "txt",id_seq: list[int] | None = None,hyperlink_resolver: HyperlinkResolver | None = None,+ strict: bool = False,+ diagnostic_sink: TextDiagnosticSink | None = None,) -> TextRun:"""Resolve a single <a:r> run from its rPr and fallback run properties."""style_chain = (@@ -586,8 +609,19 @@ def _build_run(if spc is not None:try:letter_spacing_px = float(spc) / 100.0 * 4.0 / 3.0 # pt -> px- except ValueError:- pass+ except ValueError as exc:+ message = (+ f"Invalid DrawingML a:rPr@spc value {spc!r}; expected a numeric "+ "hundredths-of-a-point value"+ )+ if strict:+ raise TextImportError(message) from exc+ if diagnostic_sink is not None:+ diagnostic_sink(+ "text-letter-spacing-normalized",+ message,+ "use zero letter spacing for this run",+ )# Colorfill = default_filldiff --git a/skills/ppt-master/scripts/source_to_md/ppt_to_md.py b/skills/ppt-master/scripts/source_to_md/ppt_to_md.pyindex 3a6d0c7e..febd3e47 100644--- a/skills/ppt-master/scripts/source_to_md/ppt_to_md.py+++ b/skills/ppt-master/scripts/source_to_md/ppt_to_md.py@@ -789,27 +789,33 @@ def _unexposed_chartex_markdown(return blocks-def _image_part_for_shape(shape: object) -> object | None:- """Return the first embedded image part referenced by a shape."""+def _image_part_for_shape(shape: object) -> tuple[object | None, str | None]:+ """Return the first referenced image part plus any resolution failure."""element = getattr(shape, "element", None)- part = getattr(shape, "part", None)- if element is None or part is None:- return None+ if element is None:+ return None, "shape XML is unavailable while inspecting image references"try:blips = element.xpath(".//a:blip")- except Exception:- return None+ except Exception as exc:+ return None, (+ "image reference scan failed "+ f"({type(exc).__name__}: {exc})"+ )+ part = getattr(shape, "part", None)+ failures: list[str] = []for blip in blips:rel_id = blip.get(qn("r:embed")) or blip.get(qn("r:link"))if not rel_id:continuetry:- return part.related_part(rel_id)- except Exception:- continue- return None+ return part.related_part(rel_id), None+ except Exception as exc:+ failures.append(f"{rel_id} ({type(exc).__name__}: {exc})")+ if failures:+ return None, "image relationship resolution failed: " + "; ".join(failures)+ return None, Nonedef _image_size_from_bytes(blob: bytes) -> tuple[int | None, int | None]:@@ -959,6 +965,7 @@ def _asset_filename(def save_picture(shape: object,+ image_part: object,asset_dir: Path,slide_index: int,asset_index: int,@@ -966,10 +973,6 @@ def save_picture(used_filenames: set[str],) -> SavedPicture | None:"""Persist a shape image to the output asset directory."""- image_part = _image_part_for_shape(shape)- if image_part is None:- return None-content_type = getattr(image_part, "content_type", None)part_ext = getattr(getattr(image_part, "partname", None), "ext", None)ext = normalize_ext(part_ext, content_type)@@ -1022,12 +1025,12 @@ def _reset_generated_asset_dir(asset_dir: Path) -> None:shutil.rmtree(asset_dir)-def extract_notes(slide: object) -> str:- """Extract speaker notes text from a slide, if available."""+def extract_notes(slide: object) -> tuple[str, str | None]:+ """Extract speaker notes text plus any notes-slide access failure."""try:notes_slide = slide.notes_slide- except Exception:- return ""+ except Exception as exc:+ return "", f"speaker notes read failed ({type(exc).__name__}: {exc})"blocks = []for item in iter_leaf_shapes(notes_slide.shapes):@@ -1038,7 +1041,7 @@ def extract_notes(slide: object) -> str:if text:blocks.append(text)- return "\n\n".join(blocks).strip()+ return "\n\n".join(blocks).strip(), Nonedef convert_presentation_to_markdown(@@ -1152,18 +1155,29 @@ def convert_presentation_to_markdown(MSO_SHAPE_TYPE.PICTURE,MSO_SHAPE_TYPE.LINKED_PICTURE,}- has_shape_image = is_picture_shape or _image_part_for_shape(shape) is not None+ image_part, image_error = _image_part_for_shape(shape)+ if image_error is not None:+ shape_name = getattr(shape, "name", "") or "unnamed shape"+ warning = f"Slide {slide_index}, {shape_name}: {image_error}"+ conversion_warnings.append(warning)+ print(f"[WARN] ppt_to_md: {warning}", file=sys.stderr)+ has_shape_image = is_picture_shape or image_part is not Noneif has_shape_image:image_ref_count += 1next_image_index = image_count + 1asset_dir.mkdir(parents=True, exist_ok=True)- saved_picture = save_picture(- shape,- asset_dir,- slide_index,- next_image_index,- asset_cache,- used_filenames,+ saved_picture = (+ save_picture(+ shape,+ image_part,+ asset_dir,+ slide_index,+ next_image_index,+ asset_cache,+ used_filenames,+ )+ if image_part is not None+ else None)if saved_picture is None:if is_picture_shape:@@ -1234,7 +1248,11 @@ def convert_presentation_to_markdown(lines.append("_No extractable text content._")lines.append("")- notes_md = extract_notes(slide)+ notes_md, notes_error = extract_notes(slide)+ if notes_error is not None:+ warning = f"Slide {slide_index}: {notes_error}"+ conversion_warnings.append(warning)+ print(f"[WARN] ppt_to_md: {warning}", file=sys.stderr)if notes_md:lines.append("### Speaker Notes")lines.append("")