1
0

feat: 实现幻灯片备注功能,将description写入PPT备注页

- 添加 PptxGenerator._set_notes() 方法设置备注
- 在 add_slide() 中调用 _set_notes() 处理 description
- 仅幻灯片级别的 description 写入备注,不继承模板
- 添加备注功能测试用例(8个测试)
- 更新 README.md 和 README_DEV.md 文档
- 新建 pptx-slide-notes spec
- 更新 page-description spec 允许写入备注
- 归档 add-slide-notes 变更
This commit is contained in:
2026-03-04 14:47:03 +08:00
parent f34405be36
commit 7ef29ea039
12 changed files with 454 additions and 15 deletions

View File

@@ -60,6 +60,11 @@ class PptxGenerator:
for elem in elements:
self._render_element(slide, elem, base_path)
# 设置备注
description = slide_data.get('description')
if description:
self._set_notes(slide, description)
def _render_element(self, slide, elem, base_path):
"""
分发元素到对应的渲染方法
@@ -269,6 +274,20 @@ class PptxGenerator:
from utils import log_info
log_info(f"图片背景暂未实现: {background['image']}")
def _set_notes(self, slide, text):
"""
设置幻灯片备注
Args:
slide: pptx slide 对象
text: 备注文本内容
"""
if text is None:
return
notes_slide = slide.notes_slide
text_frame = notes_slide.notes_text_frame
text_frame.text = text
def save(self, output_path):
"""
保存 PPTX 文件