2fd8bc1b4a
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规范文件
2026-03-04 13:22:33 +08:00
5d60f3c2c2
feat: 实现模板元素混合模式功能
...
新增混合模式,允许幻灯片同时使用 template 和 elements,实现更灵活的布局组合。
核心变更:
- core/presentation.py: 修改 render_slide() 支持三种模式(纯模板/纯自定义/混合模式)
- 自定义元素可访问模板变量,实现主题色等值的统一控制
- 元素采用简单追加策略合并(模板元素在前,自定义元素在后)
- 完全向后兼容现有用法
测试覆盖:
- 新增 TestRenderSlideHybridMode 测试类,包含 8 个测试用例
- 验证向后兼容性(纯模板模式、纯自定义模式)
- 验证混合模式功能(变量共享、空元素列表、元素顺序等)
- 所有 79 个测试通过
文档更新:
- README.md: 新增"混合模式模板"章节,包含语法示例和使用场景
- README_DEV.md: 更新开发文档,说明元素合并策略和实现细节
规范更新:
- openspec/specs/template-system/spec.md:
- 修改"系统必须支持自定义幻灯片"需求,支持混合模式
- 新增 4 个需求:变量共享、元素合并策略、向后兼容、内联模板支持
- 新增 13 个场景定义
归档:
- openspec/changes/archive/2026-03-04-template-element-composition/: 完整变更记录
2026-03-04 13:12:51 +08:00
5b367f7ef3
fix: 修复多行文本渲染时字号只应用于第一段的bug
...
当使用 YAML 多行字符串语法定义文本内容时,python-pptx 会自动
将包含换行符的文本分割成多个段落。修改 _render_text 方法使其
遍历所有段落并应用相同的字体样式(大小、粗体、斜体、颜色、对齐)。
主要变更:
- renderers/pptx_renderer.py: 将 p = tf.paragraphs[0] 改为 for p in tf.paragraphs
- tests/unit/test_renderers/test_pptx_renderer.py: 新增多行文本测试用例
- openspec/specs/element-rendering/spec.md: 更新 spec 文档
- openspec/changes/archive/: 归档完成的变更
2026-03-04 12:18:23 +08:00
900a38b705
chroe: 增加claude允许内容
2026-03-04 10:31:26 +08:00
19d6661381
feat: 添加图片适配模式支持
...
- 支持四种图片适配模式:stretch、contain、cover、center
- 支持背景色填充功能(contain 和 center 模式)
- 支持文档级 DPI 配置(metadata.dpi)
- PPTX 渲染器集成 Pillow 实现高质量图片处理
- HTML 渲染器使用 CSS object-fit 实现相同效果
- 添加完整的单元测试、集成测试和端到端测试
- 更新 README 文档和架构文档
- 模块化设计:utils/image_utils.py 图片处理工具模块
- 添加图片配置验证器:validators/image_config.py
- 向后兼容:未指定 fit 时默认使用 stretch 模式
2026-03-04 10:29:21 +08:00
16ca9d77cd
feat: 增强模板条件渲染表达式支持
...
使用 simpleeval 库替换原有的简单正则匹配,支持复杂的条件表达式评估。新增 ConditionEvaluator 类处理条件逻辑,支持比较运算、逻辑运算、成员测试、数学计算和内置函数,同时保持向后兼容性。
2026-03-03 17:28:23 +08:00
01a93ce13b
feat: 添加页面级 enabled 参数支持幻灯片启用/禁用控制
...
添加页面级 enabled 布尔参数,用于临时禁用整个幻灯片,无需删除或注释 YAML 内容。
与元素级 visible 条件渲染独立工作,提供两层控制机制。
主要变更:
- 在 yaml2pptx.py 主循环中检查 enabled 参数,跳过禁用的幻灯片
- 实现独立的 slide_index 计数器,准确统计实际渲染的幻灯片数量
- 在 yaml_loader.py 中添加 enabled 字段验证,确保类型为布尔值
- 添加 11 个测试用例,覆盖各种使用场景
- 更新 README.md 和 README_DEV.md 文档,说明 enabled 和 visible 的区别
- 创建新的 slide-enabled-control capability 规范
- 更新 template-system 规范,添加 enabled 字段支持
使用示例:
slides:
- template: title-slide
vars:
title: "正常页面"
- enabled: false
template: work-in-progress
vars:
title: "临时禁用的页面"
测试:所有 282 个单元测试通过
2026-03-03 16:33:10 +08:00
01eacb0b97
feat: 添加内联模板支持
...
支持在 YAML 源文件中直接定义模板,无需单独的模板文件。
简化单文档编写流程,降低模板系统使用门槛。
核心功能:
- 在 YAML 顶层新增 templates 字段定义内联模板
- 支持变量替换、条件渲染、默认值等完整模板功能
- 内联模板优先于外部模板查找
- 同名冲突检测:禁止内联和外部模板同名
- 相互引用检测:禁止内联模板之间相互引用
- 完整的错误处理和验证机制
代码变更:
- core/template.py: 新增 from_data() 类方法
- core/presentation.py: 支持内联模板查找和冲突检测
- loaders/yaml_loader.py: 新增 validate_templates_yaml() 验证
- validators/: 扩展验证器支持内联模板
测试:
- 新增 9 个内联模板专项测试
- 修复 1 个变量验证测试
- 所有 333 个测试通过
文档:
- README.md: 添加内联模板使用指南和最佳实践
- README_DEV.md: 说明实现细节和设计决策
完全向后兼容,不使用 templates 字段时行为不变。
2026-03-03 15:59:55 +08:00
2ba1bd7272
chore: add OpenCode configuration files
2026-03-03 11:34:03 +08:00
22614d6f55
fix: 修复 7 个失败测试和 1 个错误测试
...
- 修复 conftest_pptx.py 中元素类型检测:使用 has_text_frame 替代不存在的 MSO_SHAPE.TEXT_BOX
- 修复 test_presentation.py 中 3 个测试:使用对象属性访问替代字典访问
- 修复 unit/test_presentation.py 中路径比较问题
- 添加缺失的 mock_template_class fixture
测试通过率: 316/316 (100%)
代码覆盖率: 94%
2026-03-03 01:25:36 +08:00
e82a6a945e
chore: 更新 OpenSpec 上下文配置
2026-03-03 01:00:36 +08:00
ef3fa6a06a
feat: 添加模板变量验证功能
...
- 在 ResourceValidator 中添加 validate_template_vars 方法
- 在验证阶段检查用户是否提供了模板所需的必需变量
- 缺少必需变量时返回 ERROR 级别错误
- 添加 9 个单元测试用例验证功能
- 同步更新 OpenSpec 规格文档
2026-03-03 01:00:21 +08:00
e31a7e9bed
chore: 归档测试修复变更
2026-03-03 00:42:46 +08:00
c73bd0fedd
fix: 修复测试问题,提升测试通过率
...
修复内容:
- E2E测试命令执行方式:将 python -m uv run 改为 uv run
- HTML渲染器:添加 & 字符的HTML转义
- Presentation尺寸验证:添加尺寸值类型验证
- PPTX验证器:修复文本框检测兼容性
- 验证结果格式化:修复提示信息显示
- Mock配置:修复表格渲染等测试的Mock配置
测试结果:
- 修复前: 264 通过, 42 失败, 1 错误
- 修复后: 297 通过, 9 失败, 1 错误
剩余9个失败为待实现的功能增强(验证器模板变量验证)
2026-03-03 00:42:39 +08:00
f273cef195
fix: use quoted strings for size values in YAML to prevent time parsing
...
YAML parser interprets 16:9 as time format (16h 9m = 969s).
Using quoted strings "16:9" ensures correct string parsing.
2026-03-02 23:50:31 +08:00
ab2510a400
test: add comprehensive pytest test suite
...
Add complete test infrastructure for yaml2pptx project with 245+ tests
covering unit, integration, and end-to-end scenarios.
Test structure:
- Unit tests: elements, template system, validators, loaders, utils
- Integration tests: presentation and rendering flows
- E2E tests: CLI commands (convert, check, preview)
Key features:
- PptxFileValidator for Level 2 PPTX validation (file structure,
element count, content matching, position tolerance)
- Comprehensive fixtures for test data consistency
- Mock-based testing for external dependencies
- Test images generated with PIL/Pillow
- Boundary case coverage for edge scenarios
Dependencies added:
- pytest, pytest-cov, pytest-mock
- pillow (for test image generation)
Documentation updated:
- README.md: test running instructions
- README_DEV.md: test development guide
Co-authored-by: OpenSpec change: add-comprehensive-tests
2026-03-02 23:11:34 +08:00
027a832c9a
chore: migrate to uv pyproject.toml for dependency management
...
- Add pyproject.toml with project dependencies
- Remove inline script metadata from yaml2pptx.py
- Update openspec/config.yaml development guidelines
- Update README.md and README_DEV.md documentation
- Archive change: migrate-to-uv-package-management
2026-03-02 22:03:23 +08:00
0a804eacc8
chore: update Claude Code permissions configuration
...
更新 Claude Code 的权限配置,简化命令权限管理。
变更:
- 添加 WebFetch(*) 权限
- 简化 Bash 权限配置(使用通配符模式)
- 添加 git 和 uv 命令权限
2026-03-02 18:48:51 +08:00
66472cbd86
refactor: restructure CLI with clear subcommand architecture
...
重构命令行接口,建立清晰的子命令架构,提升用户体验和代码可维护性。
主要变更:
- 移除传统模式,统一使用子命令架构(check/convert/preview)
- 将 preview 从 convert 的标志独立为子命令,职责分离
- 重命名参数:--no-check → --skip-validation
- 新增 --force/-f:convert 命令支持强制覆盖已存在文件
- 新增 --host:preview 命令支持配置主机地址(局域网预览)
- 新增 --no-browser:preview 命令支持不自动打开浏览器
- 优化 --port 默认值:从固定端口改为随机端口(30000-40000)
破坏性变更:
- 不再支持传统模式(yaml2pptx.py input.yaml output.pptx)
- convert 命令不再支持 --preview 参数,需使用 preview 子命令
文档更新:
- 更新 README.md 和 README_DEV.md 的所有使用示例
- 更新命令行选项说明表格
- 新增 CLI 接口规范文档
OpenSpec:
- 创建 cli-interface 规范(新能力)
- 更新 browser-preview-server 规范(修改的能力)
- 归档 refactor-cli-args change(45/45 任务完成)
2026-03-02 18:47:50 +08:00
83ff827ad1
feat: add YAML validation with check command and auto-validation
...
Implements comprehensive validation before PPTX conversion to catch errors early. Includes element-level validation (colors, fonts, table consistency) and system-level validation (geometry, resources). Supports standalone check command and automatic validation during conversion.
2026-03-02 18:14:45 +08:00
d598de27b3
chore: untrack .claude/settings.local.json from global ignore
...
Override global gitignore rule to allow project-specific Claude settings.
2026-03-02 16:51:17 +08:00
ed940f0690
refactor: modularize yaml2pptx into layered architecture
...
Refactor yaml2pptx.py from a 1,245-line monolithic script into a modular
architecture with clear separation of concerns. The entry point is now
127 lines, with business logic distributed across focused modules.
Architecture:
- core/: Domain models (elements, template, presentation)
- loaders/: YAML loading and validation
- renderers/: PPTX and HTML rendering
- preview/: Flask preview server
- utils.py: Shared utilities
Key improvements:
- Element abstraction layer using dataclass with validation
- Renderer logic built into generator classes
- Single-direction dependencies (no circular imports)
- Each module 150-300 lines for better readability
- Backward compatible CLI interface
Documentation:
- README.md: User-facing usage guide
- README_DEV.md: Developer documentation
OpenSpec:
- Archive refactor-yaml2pptx-modular change (63/70 tasks complete)
- Sync 5 delta specs to main specs (2 new + 3 updated)
2026-03-02 16:43:45 +08:00
b2132dc06b
feat: enable text auto-wrap for text boxes by default
...
- Set text_frame.word_wrap = True in add_text_element() for PPTX
- Change CSS from white-space: pre-wrap to normal in HTML preview
- Add overflow-wrap: break-word for better word breaking
- Update README.md with auto-wrap documentation
- Update element-rendering and html-rendering specs
- Archive change: 2026-03-02-add-text-auto-wrap
2026-03-02 15:23:14 +08:00
cd7988cbd5
feat: initial implementation of html2pptx with OpenSpec documentation
...
Add core Python script (yaml2pptx.py) for converting YAML to PowerPoint:
- Element rendering: text, image, shape, table, chart
- Template system with placeholders
- PPTX generation with python-pptx
OpenSpec workflow setup:
- 3 archived changes: browser-preview, template-dir-cli, yaml-to-pptx
- 7 main specifications covering all core modules
- Config and documentation structure
30 files changed, 4984 insertions(+)
2026-03-02 14:28:25 +08:00
6cb422a72a
feat: add OpenSpec workflow configuration
...
Add comprehensive OpenSpec workflow support for Claude Code and OpenCode:
- Commands: apply, archive, bulk-archive, continue, explore, ff, new, onboard, propose, sync, verify
- Skills: 11 specialized skills for change management workflow
- Supports artifact-based development with structured change tracking
44 files changed, 8017 insertions(+)
2026-03-02 14:27:53 +08:00
482f9cbbad
chore: add comprehensive .gitignore for cross-platform development
...
Add .gitignore covering:
- Operating systems: macOS, Windows, Linux
- IDEs: VSCode, JetBrains, Eclipse, Vim, Emacs
- AI editors: Claude Code, OpenCode, Cursor, Aider, etc.
- Python: venv, __pycache__, dist, coverage
- Project: generated presentations, logs, env files
2026-03-02 14:26:41 +08:00