1
0

feat: 为metadata、模板和幻灯片添加description字段支持

添加可选的description字段用于文档目的,不影响渲染输出。

主要更改:
- core/presentation.py: 添加metadata.description属性
- core/template.py: 添加template.description属性
- tests: 添加16个新测试用例验证description功能
- docs: 更新README.md和README_DEV.md文档
- specs: 新增page-description规范文件
This commit is contained in:
2026-03-04 13:22:33 +08:00
parent 5d60f3c2c2
commit 2fd8bc1b4a
12 changed files with 845 additions and 0 deletions

View File

@@ -136,6 +136,16 @@ metadata:
dpi: 150 # 高质量输出
```
#### description 字段
`metadata.description` 字段用于描述整个演示文稿的概要和用途,仅用于文档目的,不影响生成的 PPTX 文件:
```yaml
metadata:
size: "16:9"
description: "2024年度项目进展总结包含背景、成果和展望"
```
### 使用模板
```yaml
@@ -418,6 +428,27 @@ slides:
author: "作者"
```
#### 模板 description 字段
模板文件可以包含可选的 `description` 字段,用于描述模板的用途和设计意图,仅用于文档目的:
```yaml
# templates/title-slide.yaml
description: "用于章节标题页的模板,包含主标题和副标题"
vars:
- name: title
required: true
elements:
- type: text
box: [1, 2, 8, 1]
content: "{title}"
font:
size: 44
bold: true
```
### 混合模式模板
混合模式允许你在使用模板的同时添加自定义元素,实现更灵活的布局组合。
@@ -583,6 +614,23 @@ slides:
content: "额外内容"
```
#### 幻灯片 description 字段
幻灯片可以包含可选的 `description` 字段,用于描述该幻灯片的作用和内容,仅用于文档目的,不影响生成的 PPTX 文件:
```yaml
slides:
- description: "介绍项目背景和目标"
template: title-slide
vars:
title: "项目背景"
- description: "展示核心功能特性"
elements:
- type: text
content: "功能特性"
```
### 条件渲染
#### 元素级条件渲染