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): normalize package metadata for PowerPoint
hugohe30dfdff7c6500
diff --git a/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py b/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.pyindex dc09857b..629057fb 100644--- a/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py+++ b/skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py@@ -118,6 +118,9 @@ def _add_default_content_type(content_types: str, extension: str, content_type:if f'Extension="{ext}"' in content_types:return content_typesentry = f' <Default Extension="{ext}" ContentType="{content_type}"/>'+ override_pos = content_types.find('<Override ')+ if override_pos >= 0:+ return content_types[:override_pos] + entry + '\n' + content_types[override_pos:]return content_types.replace('</Types>', entry + '\n</Types>')@@ -508,6 +511,41 @@ def _presentation_format(width: float, height: float) -> str:return 'Custom'+def _slide_size_type(width: float, height: float) -> str:+ """Return the PowerPoint slide-size type matching the actual dimensions."""+ if width <= 0 or height <= 0:+ return 'custom'+ ratio = width / height+ if abs(ratio - (16 / 9)) < 0.02:+ return 'wide'+ if abs(ratio - (4 / 3)) < 0.02:+ return 'screen4x3'+ return 'custom'+++def _normalize_slide_size_type(extract_dir: Path, width: float, height: float) -> None:+ """Keep p:sldSz@type consistent with the exported slide dimensions."""+ presentation_path = extract_dir / 'ppt' / 'presentation.xml'+ if not presentation_path.exists():+ return+ presentation_xml = presentation_path.read_text(encoding='utf-8')+ size_type = _slide_size_type(width, height)++ def replace_sld_size(match: re.Match[str]) -> str:+ element = match.group(0)+ if ' type="' in element:+ return re.sub(r' type="[^"]*"', f' type="{size_type}"', element, count=1)+ return element[:-2] + f' type="{size_type}"/>'++ presentation_xml = re.sub(+ r'<p:sldSz\b[^>]*/>',+ replace_sld_size,+ presentation_xml,+ count=1,+ )+ presentation_path.write_text(presentation_xml, encoding='utf-8')++def _stamp_docprops(extract_dir: Path,slide_count: int,@@ -1065,22 +1103,16 @@ def create_pptx_with_native_svg(with open(content_types_path, 'r', encoding='utf-8') as f:content_types = f.read()- types_to_add: list[str] = []if not use_native_shapes:- if 'Extension="svg"' not in content_types:- types_to_add.append(' <Default Extension="svg" ContentType="image/svg+xml"/>')+ content_types = _add_default_content_type(content_types, 'svg', 'image/svg+xml')for ext in sorted(image_exts_used):- if f'Extension="{ext}"' not in content_types:- types_to_add.append(- f' <Default Extension="{ext}" ContentType="{_content_type_for_extension(ext)}"/>'- )-- if types_to_add:- content_types = content_types.replace(- '</Types>', '\n'.join(types_to_add) + '\n</Types>',+ content_types = _add_default_content_type(+ content_types,+ ext,+ _content_type_for_extension(ext),)- with open(content_types_path, 'w', encoding='utf-8') as f:- f.write(content_types)+ with open(content_types_path, 'w', encoding='utf-8') as f:+ f.write(content_types)if audio_exts_used:for ext in sorted(audio_exts_used):@@ -1125,6 +1157,7 @@ def create_pptx_with_native_svg(# author, 2013 dates, "generated using python-pptx", Slides=0) with# accurate, tool-neutral document properties.pres_format = _presentation_format(width_emu, height_emu)+ _normalize_slide_size_type(extract_dir, width_emu, height_emu)_stamp_docprops(extract_dir, len(svg_files), pres_format, doc_metadata)# Repackage PPTX to a temporary file first. The public output path is