Adds support for Shape Groups
This commit is contained in:
parent
dbdf2c0c10
commit
f8c14a8928
1 changed files with 12 additions and 2 deletions
|
|
@ -64,7 +64,9 @@ class PptxConverter(HtmlConverter):
|
||||||
md_content += f"\n\n<!-- Slide number: {slide_num} -->\n"
|
md_content += f"\n\n<!-- Slide number: {slide_num} -->\n"
|
||||||
|
|
||||||
title = slide.shapes.title
|
title = slide.shapes.title
|
||||||
for shape in slide.shapes:
|
|
||||||
|
def get_shape_content(shape, **kwargs):
|
||||||
|
nonlocal md_content
|
||||||
# Pictures
|
# Pictures
|
||||||
if self._is_picture(shape):
|
if self._is_picture(shape):
|
||||||
# https://github.com/scanny/python-pptx/pull/512#issuecomment-1713100069
|
# https://github.com/scanny/python-pptx/pull/512#issuecomment-1713100069
|
||||||
|
|
@ -125,7 +127,7 @@ class PptxConverter(HtmlConverter):
|
||||||
|
|
||||||
# Charts
|
# Charts
|
||||||
if shape.has_chart:
|
if shape.has_chart:
|
||||||
md_content += self._convert_chart_to_markdown(shape.chart)
|
self._convert_chart_to_markdown(shape.chart)
|
||||||
|
|
||||||
# Text areas
|
# Text areas
|
||||||
elif shape.has_text_frame:
|
elif shape.has_text_frame:
|
||||||
|
|
@ -134,6 +136,14 @@ class PptxConverter(HtmlConverter):
|
||||||
else:
|
else:
|
||||||
md_content += shape.text + "\n"
|
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()
|
md_content = md_content.strip()
|
||||||
|
|
||||||
if slide.has_notes_slide:
|
if slide.has_notes_slide:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue