1
0

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)
This commit is contained in:
2026-03-02 16:43:45 +08:00
parent b2132dc06b
commit ed940f0690
31 changed files with 3142 additions and 1307 deletions

View File

@@ -5,4 +5,6 @@ context: |
本项目编写的python脚本始终使用uv运行脚本使用Inline script metadata来指定脚本的依赖包和python运行版本
严禁直接使用主机环境的python直接执行脚本严禁在主机环境直接安装python依赖包
本项目编写的测试文件、临时文件必须放在temp目录下
严禁污染主机环境的任何配置,如有需要,必须请求用户审核操作;
严禁污染主机环境的任何配置,如有需要,必须请求用户审核操作;
当前项目的面向用户的使用文档在README.md
当前项目的面向AI和开发者的开发规范文档在README_DEV.md