feat: 新增 PPT 旧格式支持,重构 LibreOffice 转换工具

- 新增 PPT (旧格式) 解析器
- 重构 _utils.py,提取通用 convert_via_libreoffice 函数
- 更新依赖配置,添加 PPT 相关依赖
- 完善文档,更新 README 和 SKILL.md
- 添加 PPT 文件检测函数
- 新增 PPT 解析器测试用例
This commit is contained in:
2026-03-16 22:49:04 +08:00
parent 1306dd5971
commit a490b2642c
14 changed files with 355 additions and 51 deletions

View File

@@ -0,0 +1,35 @@
"""测试 LibreOffice PPT Reader 的解析功能。"""
import pytest
import os
from readers.ppt import libreoffice
class TestLibreOfficePptReaderParse:
"""测试 LibreOffice PPT Reader 的 parse 方法。"""
def test_simple_ppt(self, simple_ppt_path):
"""测试简单 PPT 文件解析。"""
content, error = libreoffice.parse(simple_ppt_path)
if content is not None:
# 至少能解析出一些内容
assert content.strip() != ""
def test_multiple_slides_ppt(self, multiple_slides_ppt_path):
"""测试多幻灯片 PPT 文件解析。"""
content, error = libreoffice.parse(multiple_slides_ppt_path)
if content is not None:
assert content.strip() != ""
def test_with_images_ppt(self, with_images_ppt_path):
"""测试带图片的 PPT 文件解析。"""
content, error = libreoffice.parse(with_images_ppt_path)
if content is not None:
assert content.strip() != ""
def test_file_not_exists(self, tmp_path):
"""测试文件不存在的情况。"""
non_existent_file = str(tmp_path / "non_existent.ppt")
content, error = libreoffice.parse(non_existent_file)
assert content is None
assert error is not None