Add Support For PPTX Shape Groups (Fix in code design to not miss out on slide content) (#331)

* Adds support for Shape Groups

* Update to Test PPtx for nested shape

* This line was accidentally removed and is added back here
This commit is contained in:
Matthew Powers
2025-02-28 02:21:51 -05:00
committed by GitHub
parent a394cc7c27
commit e82e0c1372
2 changed files with 11 additions and 1 deletions

View File

@@ -64,7 +64,9 @@ class PptxConverter(HtmlConverter):
md_content += f"\n\n<!-- Slide number: {slide_num} -->\n"
title = slide.shapes.title
for shape in slide.shapes:
def get_shape_content(shape, **kwargs):
nonlocal md_content
# Pictures
if self._is_picture(shape):
# https://github.com/scanny/python-pptx/pull/512#issuecomment-1713100069
@@ -134,6 +136,14 @@ class PptxConverter(HtmlConverter):
else:
md_content += shape.text + "\n"
# Group Shapes
if shape.shape_type == pptx.enum.shapes.MSO_SHAPE_TYPE.GROUP:
for subshape in shape.shapes:
get_shape_content(subshape, **kwargs)
for shape in slide.shapes:
get_shape_content(shape, **kwargs)
md_content = md_content.strip()
if slide.has_notes_slide: