skills/ppt-station-skill/ppt_station/utils/template_utils.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

38 lines
745 B
Python

"""
模板工具函数
"""
from pptx.presentation import Presentation
from pptx.slide import Slide
def find_shape_by_name(slide: Slide, name: str):
"""
在幻灯片中查找指定名称的形状
Args:
slide: 幻灯片对象
name: 形状名称
Returns:
找到的形状对象,未找到返回 None
"""
for shape in slide.shapes:
if shape.name == name:
return shape
return None
def get_slide_layouts(prs: Presentation) -> dict:
"""
获取演示文稿中的所有幻灯片版式
Args:
prs: 演示文稿对象
Returns:
版式名称到版式对象的映射字典
"""
return {layout.name: layout for layout in prs.slide_layouts}