Skip to content

Commit 7647212

Browse files
committed
fix(pptx): remove invalid slide size metadata normalization
1 parent 767332d commit 7647212

2 files changed

Lines changed: 0 additions & 50 deletions

File tree

examples/ppt169_general_dark_tech_claude_code_auto_mode/README.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

skills/ppt-master/scripts/svg_to_pptx/pptx_builder.py

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -521,41 +521,6 @@ def _presentation_format(width: float, height: float) -> str:
521521
return 'Custom'
522522

523523

524-
def _slide_size_type(width: float, height: float) -> str:
525-
"""Return the PowerPoint slide-size type matching the actual dimensions."""
526-
if width <= 0 or height <= 0:
527-
return 'custom'
528-
ratio = width / height
529-
if abs(ratio - (16 / 9)) < 0.02:
530-
return 'wide'
531-
if abs(ratio - (4 / 3)) < 0.02:
532-
return 'screen4x3'
533-
return 'custom'
534-
535-
536-
def _normalize_slide_size_type(extract_dir: Path, width: float, height: float) -> None:
537-
"""Keep p:sldSz@type consistent with the exported slide dimensions."""
538-
presentation_path = extract_dir / 'ppt' / 'presentation.xml'
539-
if not presentation_path.exists():
540-
return
541-
presentation_xml = presentation_path.read_text(encoding='utf-8')
542-
size_type = _slide_size_type(width, height)
543-
544-
def replace_sld_size(match: re.Match[str]) -> str:
545-
element = match.group(0)
546-
if ' type="' in element:
547-
return re.sub(r' type="[^"]*"', f' type="{size_type}"', element, count=1)
548-
return element[:-2] + f' type="{size_type}"/>'
549-
550-
presentation_xml = re.sub(
551-
r'<p:sldSz\b[^>]*/>',
552-
replace_sld_size,
553-
presentation_xml,
554-
count=1,
555-
)
556-
presentation_path.write_text(presentation_xml, encoding='utf-8')
557-
558-
559524
def _stamp_docprops(
560525
extract_dir: Path,
561526
slide_count: int,
@@ -1176,7 +1141,6 @@ def create_pptx_with_native_svg(
11761141
# author, 2013 dates, "generated using python-pptx", Slides=0) with
11771142
# accurate, tool-neutral document properties.
11781143
pres_format = _presentation_format(width_emu, height_emu)
1179-
_normalize_slide_size_type(extract_dir, width_emu, height_emu)
11801144
_stamp_docprops(extract_dir, len(svg_files), pres_format, doc_metadata)
11811145

11821146
# Repackage PPTX to a temporary file first. The public output path is

0 commit comments

Comments
 (0)