skills/ppt-station-skill/scripts/parse_ppt.py
wangyitong a65adcc2e5 Initial commit: merged, deduplicated, and vetted skill collection
Sources: extracted from two upstream archives (skill-repo, skills-main),
merged with the following policy:

- 15 broken symlinks (pointing to /Users/jameslee/.cc-switch/skills or
  ../../.agents/skills on a foreign machine) discarded
- 3 real name collisions with identical content (ai-pair, ifind-http-api,
  zhipu-websearch) kept as one copy
- Functional overlaps deduped keeping the strongest variant:
  - docx family: kept docx (official, full toolchain) + docx-cn
    (GB/T 9704 Chinese official-document constants),
    dropped docx_writer (no scripts, name collided with docx)
  - humanizer family: kept humanizer-zh (6 zh reference docs),
    dropped humanizer (en, redundant for CN workflow)
- Skills that only ran in a foreign environment removed:
  ablemind-ops, app-publish, hlb-design-system, openclaw-adj-skill,
  claude-driver
- alphapai excluded from this public repo because its SKILL.md hard-coded
  live credentials

Result: 25 skills, 572 files, ~7.5 MB.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 14:47:12 +08:00

50 lines
1.4 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""将 PPT 解析为 JSON 中间格式
用法: python parse_ppt.py <input.pptx> [output.json]
如果不指定 output.json则输出到 stdout
"""
import sys
import json
import argparse
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from ppt_station.parsers.ppt_parser import PPTParser
def main():
parser = argparse.ArgumentParser(description="PPT → JSON 解析")
parser.add_argument("input", help="输入 .pptx 文件路径")
parser.add_argument("output", nargs="?", help="输出 .json 文件路径(可选,默认输出到 stdout")
args = parser.parse_args()
input_path = Path(args.input)
if not input_path.exists():
print(f"错误: 文件不存在: {input_path}", file=sys.stderr)
sys.exit(1)
# 重定向 print 到 stderr
old_stdout = sys.stdout
sys.stdout = sys.stderr
ppt_parser = PPTParser(input_path)
if args.output:
output_path = Path(args.output)
output_path.parent.mkdir(parents=True, exist_ok=True)
ppt_parser.save_to_json(output_path)
sys.stdout = old_stdout
print(json.dumps({"status": "ok", "output": str(output_path)}))
else:
result = ppt_parser.parse()
sys.stdout = old_stdout
json.dump(result, sys.stdout, ensure_ascii=False, indent=2)
print()
if __name__ == "__main__":
main()