143 lines
6.5 KiB
Python
143 lines
6.5 KiB
Python
"""
|
|
haewon이 수정한 소개서를 in-place 편집해 새 버전으로 저장한다 (원본은 건드리지 않는다).
|
|
|
|
- 표지·클로징의 로고·회사 CI 위치는 haewon 배치를 그대로 둔다
|
|
- 라이트 슬라이드(2·3·13·15)의 본문을 요금제 카드 3장으로 바꾼다. 카드 위치·높이는 네 장 모두 같다
|
|
- 5장 보고서 표지는 흰 카드 프레임 안에 넣는다
|
|
- CTA는 클로징의 문의처 한 곳만 (mailto 링크)
|
|
|
|
python3 docs/reports/outbound_webforai/edit_deck_inplace.py <haewon 수정본.pptx> <새 버전.pptx>
|
|
"""
|
|
import os
|
|
import sys
|
|
|
|
from pptx import Presentation
|
|
from pptx.util import Inches, Pt
|
|
|
|
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
import build_outbound_deck_v3 as v3 # noqa: E402
|
|
from build_outbound_deck_v3 import ACCENT, NAVY, RULE, WHITE, plan_card, shadow, text # noqa: E402
|
|
from ifd import _check, _rect # noqa: E402
|
|
|
|
E = 914400
|
|
|
|
|
|
def drop(slide, keep):
|
|
"""keep(shape)가 False인 도형을 지운다."""
|
|
for sh in [sh for sh in slide.shapes if not keep(sh)]:
|
|
sh._element.getparent().remove(sh._element)
|
|
|
|
|
|
def set_text(shape, s):
|
|
"""첫 run의 서식을 유지한 채 텍스트만 바꾼다."""
|
|
tf = shape.text_frame
|
|
for p in tf.paragraphs[1:]:
|
|
p._p.getparent().remove(p._p)
|
|
runs = tf.paragraphs[0].runs
|
|
runs[0].text = s
|
|
for r in runs[1:]:
|
|
r._r.getparent().remove(r._r)
|
|
|
|
|
|
def by_name(slide, name):
|
|
return next(sh for sh in slide.shapes if sh.name == name)
|
|
|
|
|
|
def body_only(sh):
|
|
"""헤더(제목·리드)와 푸터는 남기고 카드 밴드의 본문만 지운다."""
|
|
return not (3.5 <= sh.top / E < 10.3)
|
|
|
|
|
|
# 라이트 카드 장의 카드 3장 (장 번호 → plan_card 인자). 다시 그릴 때도 같은 문구를 쓴다
|
|
CARDS = {
|
|
2: [(("ANSWER", "검색에서 답변으로", ["AI가 병원을 직접 추천", "목록 대신 소수만 제시", "답변이 비교의 출발점"],
|
|
"AI 답변엔진 4종 실측"), {}),
|
|
(("CITATION", "인용되는 병원만 추천", ["확인 가능한 근거 선별", "근거 명확한 병원 인용", "광고 입찰과 무관"],
|
|
"공개 정보가 기준"), {}),
|
|
(("OPEN WEB", "외부 출처의 영향력", ["플랫폼 인용이 더 많음", "구청·의료관광·후기", "공식 정보 정비가 출발점"],
|
|
"답변 114건 출처 분석"), {})],
|
|
3: [(("QUESTIONS", "환자 질문", ["한국어 5 · 영어 5", "병원명 1 · 탐색 4"], "위치 서울 · 미국"), {"value": "10", "unit": "개"}),
|
|
(("ENGINES", "AI 답변엔진", ["ChatGPT · Claude", "Perplexity · Google"], "웹 검색 기반 답변"), {"value": "4", "unit": "개"}),
|
|
(("RUNS", "질의 횟수", ["질문마다 3회 측정", "원문 대조로 판정"], "측정일 10.19 · 10.26"), {"value": "120", "unit": "회"})],
|
|
13: [(("AUDIT", "정식 진단", ["홈페이지 점검", "질문 50개 이상 측정"], "산출물 · 진단 리포트"),
|
|
{"value": "36", "unit": "개 항목"}),
|
|
(("BUILD", "공식 답변 허브", ["국문 · 영문 정리", "기존 홈페이지 유지"], "산출물 · 공식 답변 허브"),
|
|
{"value": "2", "unit": "개 언어", "highlight": "WebforAI 핵심"}),
|
|
(("PROVE", "반복 측정", ["동일 질문 · 동일 조건", "언급·인용 횟수로 보고"], "산출물 · 측정 보고서"),
|
|
{"value": "8", "unit": "주"})],
|
|
15: [(("STEP 1", "결과 설명", ["답변 원문·출처 검토", "개선 우선순위 공유"], "첫 미팅"), {"value": "30", "unit": "분"}),
|
|
(("STEP 2", "정식 진단", ["홈페이지 36개 항목", "국내·해외 질문 확대"], "진단 리포트 제공"), {"value": "50", "unit": "개 이상"}),
|
|
(("STEP 3", "착수", ["측정 기준선 설정", "공식 답변 허브 구축"], "8주 후 재측정 보고"), {"value": "8", "unit": "주"})],
|
|
}
|
|
|
|
|
|
def cards(slide, page):
|
|
for i, (args, kw) in enumerate(CARDS[page]):
|
|
plan_card(slide, i, *args, **kw)
|
|
|
|
|
|
def main(src, dst):
|
|
assert not os.path.exists(dst), f"이미 있는 파일은 덮어쓰지 않습니다: {dst}"
|
|
prs = Presentation(src)
|
|
s = prs.slides
|
|
|
|
# 02 Why Now: 하단 결론 문장을 리드로 올리고 카드 3장
|
|
sl = s[1]
|
|
drop(sl, body_only)
|
|
set_text(by_name(sl, "TextBox 3"), "AI가 신뢰할 수 있는 공식 정보를 갖춘 병원이 추천 목록에 오릅니다.")
|
|
cards(sl, 2)
|
|
|
|
# 03 측정 방법: 카드 3장 (측정 조건 표는 보고서 장에 있으므로 뺀다)
|
|
sl = s[2]
|
|
drop(sl, body_only)
|
|
cards(sl, 3)
|
|
|
|
# 05 보고서 표지: 흰 카드 프레임
|
|
sl = s[4]
|
|
pic = by_name(sl, "Picture 6")
|
|
ratio = pic.height / pic.width
|
|
drop(sl, lambda sh: sh.name not in ("Rectangle 5", "Picture 6"))
|
|
w = 16.6
|
|
h = w * ratio
|
|
x, y = v3.M + (v3.W - w) / 2, 2.35
|
|
frame = _rect(sl, x - 0.3, y - 0.3, w + 0.6, h + 0.6, fill=WHITE, line=RULE, radius=0.22)
|
|
shadow(frame, 6)
|
|
sl.shapes.add_picture(v3.os.path.join(src_shots, "cover_light.png"), Inches(x), Inches(y), width=Inches(w))
|
|
|
|
# 13 오퍼링: 가운데 카드 강조 탭
|
|
sl = s[12]
|
|
drop(sl, body_only)
|
|
cards(sl, 13)
|
|
|
|
# 15 클로징: 제목 한 줄, 카드 3장, 문의처는 CTA
|
|
sl = s[14]
|
|
drop(sl, lambda sh: not (5.0 <= sh.top / E < 9.0))
|
|
title = by_name(sl, "TextBox 5")
|
|
_check("8주 안에 증명하겠습니다.", v3.W, v3.T_TITLE, 1, "closing title")
|
|
tf = title.text_frame
|
|
tf.paragraphs[0]._p.getparent().remove(tf.paragraphs[0]._p)
|
|
r = tf.paragraphs[0].runs[0]
|
|
r.font.size = Pt(v3.T_TITLE)
|
|
title.top, title.height = Inches(1.85), Inches(1.2)
|
|
text(sl, v3.M, 3.0, v3.W, 0.6, "측정은 마쳤습니다. 다음 세 단계로 진행합니다.", v3.T_LEDE, 1, "closing lede", color=v3.SLATE_700)
|
|
cards(sl, 15)
|
|
mail = by_name(sl, "TextBox 21")
|
|
my, mh = mail.top / E, mail.height / E
|
|
mail._element.getparent().remove(mail._element)
|
|
label = f"미팅 요청 {v3.CONTACT}"
|
|
pw = round(v3.ifd.em_width(label) * 26 / 72 + 1.0, 2)
|
|
px = v3.M + v3.W - pw
|
|
pill = _rect(sl, px, my - 0.1, pw, mh + 0.2, fill=NAVY, line=None, radius=(mh + 0.2) / 2)
|
|
pill.click_action.hyperlink.address = f"mailto:{v3.CONTACT}"
|
|
text(sl, px, my - 0.1, pw, mh + 0.2, label, 26.0, bold=True, color=WHITE, align=v3.ifd.PP_ALIGN.CENTER,
|
|
anchor=v3.ifd.MSO_ANCHOR.MIDDLE)
|
|
|
|
prs.save(dst)
|
|
print(dst)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
src_shots = next(a.split("=", 1)[1] for a in sys.argv if a.startswith("--shots="))
|
|
args = [a for a in sys.argv[1:] if not a.startswith("--")]
|
|
main(*args)
|