skills/ppt-station-skill/scripts/parse_template.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

46 lines
1.3 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
"""解析 .pptx 模板输出占位符清单JSON
用法: python parse_template.py <template.pptx>
输出: JSON 到 stdout日志到 stderr
"""
import sys
import json
import argparse
from pathlib import Path
# 确保 ppt_station 可导入
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
from ppt_station.template.replacer import TemplateReplacer
def main():
parser = argparse.ArgumentParser(description="解析 PPT 模板占位符")
parser.add_argument("template", help="模板 .pptx 文件路径")
parser.add_argument("--flat", action="store_true", help="不按页面分组,输出扁平列表")
args = parser.parse_args()
template_path = Path(args.template)
if not template_path.exists():
print(f"错误: 文件不存在: {template_path}", file=sys.stderr)
sys.exit(1)
# 重定向 print 到 stderr保持 stdout 纯净
import io
old_stdout = sys.stdout
sys.stdout = sys.stderr
replacer = TemplateReplacer(template_path)
result = replacer.extract_placeholders(by_page=not args.flat)
# 恢复 stdout 并输出 JSON
sys.stdout = old_stdout
json.dump(result, sys.stdout, ensure_ascii=False, indent=2)
print() # trailing newline
if __name__ == "__main__":
main()