# -*- coding: utf-8 -*-
import io, sys, os
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")

CSS = """
:root{--bg:#f7f8fa;--card:#fff;--pri:#003366;--pri2:#002244;--line:#e5e7eb;--txt:#1f2937;--sub:#6b7280;--chip:#eef3f8;--link:#003366;}
*{box-sizing:border-box}body{margin:0;font-family:-apple-system,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;background:var(--bg);color:var(--txt);line-height:1.65}
.wrap{max-width:1080px;margin:0 auto;padding:24px}
.crumb{font-size:13px;color:var(--sub);margin-bottom:14px}
.crumb a{color:var(--link);text-decoration:none}
.card{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:22px 26px;margin-bottom:18px;box-shadow:0 1px 2px rgba(0,0,0,.03)}
h1{font-size:26px;margin:0 0 6px;color:#111}h2{font-size:17px;margin:0 0 12px;color:var(--pri);border-left:4px solid var(--pri);padding-left:10px}
.meta{display:flex;flex-wrap:wrap;gap:8px;margin:10px 0 0}
.chip{background:var(--chip);color:var(--pri2);padding:3px 10px;border-radius:999px;font-size:12.5px}
.kv{display:grid;grid-template-columns:110px 1fr;row-gap:8px;font-size:14px}
.kv dt{color:var(--sub)}.kv dd{margin:0}
ul{margin:6px 0;padding-left:20px}li{margin:3px 0}
.note{background:#fffbeb;border-left:4px solid #f59e0b;padding:10px 14px;border-radius:6px;font-size:13.5px;color:#92400e;margin-top:8px}
"""

def build(school_cn, school_en, crumb, title, h1, deg_chip, disc_chip, college_chip, dept, url, ddl, lang, test, tui, core_items, elect_items, note):
    core = "".join(f"<li>{x}</li>" for x in core_items)
    elect = "".join(f"<li>{x}</li>" for x in elect_items)
    return f"""<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><title>{title} | 美加硕博项目库</title><style>{CSS}</style></head><body><div class="wrap">
<div class="crumb"><a href="../index_main.html">← 返回项目库</a> / {crumb}</div>
<div class="card">
<h1>{h1}</h1>
<div class="meta"><span class="chip">{deg_chip}</span><span class="chip">{school_cn} {school_en}</span><span class="chip">{disc_chip}</span><span class="chip">{college_chip}</span></div>
<dl class="kv" style="margin-top:14px">
<dt>开设院系</dt><dd>{dept}</dd>
<dt>官网链接</dt><dd><a href="{url}" target="_blank" rel="noopener">{url}</a></dd>
<dt>截止日期</dt><dd>{ddl}</dd>
<dt>语言要求</dt><dd>{lang}</dd>
<dt>标化考试</dt><dd>{test}</dd>
<dt>学费</dt><dd>{tui}</dd>
</dl>
</div>
<div class="card"><h2>核心课程 / 学位要求</h2><ul>{core}</ul></div>
<div class="card"><h2>方向选修 / 特色</h2><ul>{elect}</ul></div>
<div class="card"><h2>备注</h2><div class="note">{note}</div></div>
</div></body></html>"""

pages = []

# 1. UT Adult Education and Community Development
pages.append(("details/ut-cb61005.html", build(
    "多伦多大学", "University of Toronto",
    "多伦多大学 / 成人教育与社区发展硕士（MA/MEd）",
    "成人教育与社区发展硕士",
    "成人教育与社区发展硕士（MA / MEd, Adult Education and Community Development）",
    "MA / MEd", "edu", "OISE 安大略教育研究院",
    "OISE – Adult Education and Community Development",
    "https://www.sgs.utoronto.ca/programs/adult-education/",
    "SGS 页列 OISE 注册页面截止日期指引（具体轮次待补）",
    "TOEFL iBT / IELTS Academic（最低分待补）",
    "SGS 页列 N/A（不要求标化）",
    "SGS 页未列打包学费（待补）",
    ["学位授予：MA（研究型，含论文）/ MEd（授课型专业发展）",
     "最低录取：MA/MEd 需 Mid-B in final year of bachelor's；PhD 需 B+ in Master's",
     "导师在录取后由学生自行联系（Applicant secured）",
     "PhD 方向不提供本科直博（Direct entry from bachelor's to PhD: No）",
     "不要求标化考试（Standardized tests: N/A）"],
    ["方向：成人教育、社区发展、终身学习、职业教育",
     "OISE 为加拿大最大教育研究院，跨学科研究教育与社会变迁",
     "MA 含论文研究训练；MEd 为授课型专业发展",
     "EdD 为教育学博士（4年），PhD 另设"],
    "SGS 页 200 可达（441KB），Quick Facts 表提取；教育类项目业务价值偏师范，保守 stem:0；具体截止/语言最低分/打包学费 SGS 页未列，留待补。"
)))

# 2. UT Higher Education
pages.append(("details/ut-c635f90.html", build(
    "多伦多大学", "University of Toronto",
    "多伦多大学 / 高等教育硕士（MA/MEd）",
    "高等教育硕士",
    "高等教育硕士（MA / MEd, Higher Education）",
    "MA / MEd", "edu", "OISE 安大略教育研究院",
    "OISE – Higher Education",
    "https://www.sgs.utoronto.ca/programs/higher-education/",
    "SGS 页列 OISE 注册页面截止日期指引（具体轮次待补）",
    "TOEFL iBT / IELTS Academic（最低分待补）",
    "SGS 页列 N/A（不要求标化）",
    "SGS 页未列打包学费（待补）",
    ["学位授予：MA（研究型，含论文）/ MEd（授课型专业发展）",
     "最低录取：MA/MEd 需 Mid-B in final year of bachelor's；PhD 需 B+ in Master's",
     "导师在录取后由学生自行联系（Applicant secured）",
     "PhD 方向不提供本科直博（Direct entry from bachelor's to PhD: No）",
     "不要求标化考试（Standardized tests: N/A）"],
    ["方向：高等教育管理、学生事务、高等教育政策、社区学院研究",
     "面向高校行政、学生发展、教学支持从业者",
     "MA 含论文研究训练；MEd 为授课型专业发展",
     "EdD 为教育学博士（4年），PhD 另设"],
    "SGS 页 200 可达（440KB），Quick Facts 表提取；教育类项目业务价值偏师范，保守 stem:0；具体截止/语言最低分/打包学费 SGS 页未列，留待补。"
)))

# 3. UT Counselling Psychology (MEd)
pages.append(("details/ut-c6cd27b.html", build(
    "多伦多大学", "University of Toronto",
    "多伦多大学 / 心理咨询硕士（MEd）",
    "心理咨询硕士",
    "心理咨询硕士（MEd, Counselling Psychology）",
    "MEd", "edu", "OISE 安大略教育研究院",
    "OISE – Counselling Psychology",
    "https://www.sgs.utoronto.ca/programs/counselling-psychology/",
    "SGS 页列 OISE 注册页面截止日期指引（具体轮次待补）",
    "TOEFL iBT / IELTS Academic（最低分待补）",
    "SGS 页列 N/A（不要求标化）",
    "SGS 页未列打包学费（待补）",
    ["学位授予：MEd（授课型专业咨询训练）/ EdD（教育学博士）",
     "最低录取：MEd 需 B+ in final year of bachelor's（高于一般 Mid-B）；EdD 需 B+ in final year 及 B+ in Master's",
     "导师由 Graduate Unit 分配（非学生自行联系）",
     "EdD 方向不提供本科直博（Direct entry from bachelor's to PhD: No）",
     "不要求标化考试（Standardized tests: N/A）"],
    ["方向：心理咨询实践、职业发展咨询、学校辅导、多元文化咨询",
     "OISE 咨询心理学方向为加拿大咨询协会认证培养项目",
     "MEd 含实务训练与实习；EdD 为研究型博士",
     "注意：此为 MEd（教育学院），非临床心理学 PhD（临床心理属 CAAP 另设）"],
    "SGS 页 200 可达（442KB），Quick Facts 表提取；咨询心理学类项目业务价值偏师范，保守 stem:0；录取门槛 B+ 高于一般 Mid-B；具体截止/语言最低分/打包学费 SGS 页未列，留待补。"
)))

# 4. UT Curriculum and Pedagogy
pages.append(("details/ut-c83b539.html", build(
    "多伦多大学", "University of Toronto",
    "多伦多大学 / 课程与教学法硕士（MA/MEd）",
    "课程与教学法硕士",
    "课程与教学法硕士（MA / MEd, Curriculum and Pedagogy）",
    "MA / MEd", "edu", "OISE 安大略教育研究院",
    "OISE – Curriculum and Pedagogy",
    "https://www.sgs.utoronto.ca/programs/curriculum-and-pedagogy/",
    "SGS 页列 OISE 注册页面截止日期指引（具体轮次待补）",
    "TOEFL iBT / IELTS Academic（最低分待补）",
    "SGS 页列 N/A（不要求标化）",
    "SGS 页未列打包学费（待补）",
    ["学位授予：MA（研究型，含论文）/ MEd（授课型专业发展）",
     "最低录取：MA/MEd 需 Mid-B in final year of bachelor's；PhD 需 B+ in Master's",
     "导师在录取后由学生自行联系（Applicant secured）",
     "PhD 方向不提供本科直博（Direct entry from bachelor's to PhD: No）",
     "不要求标化考试（Standardized tests: N/A）"],
    ["方向：课程设计、教学法、学科教育、教师教育、课程评估",
     "涵盖科学教育、数学教育、社会研究教育、语言教育等学科方向",
     "MA 含论文研究训练；MEd 为授课型专业发展",
     "EdD 为教育学博士（4年），PhD 另设"],
    "SGS 页 200 可达（440KB），Quick Facts 表提取；教育类项目业务价值偏师范，保守 stem:0；具体截止/语言最低分/打包学费 SGS 页未列，留待补。"
)))

# 5. NYU MPA HPM
pages.append(("details/nyu-c03e53a.html", build(
    "纽约大学", "New York University",
    "纽约大学 / 卫生政策与管理硕士（MPA）",
    "卫生政策与管理硕士",
    "卫生政策与管理硕士（MPA, Health Policy and Management）",
    "MPA", "soc", "NYU Wagner 公共服务学院",
    "Robert F. Wagner Graduate School of Public Service – Health Policy and Management",
    "https://bulletins.nyu.edu/graduate/public-service/programs/health-policy-management-mpa/",
    "Wagner bulletin 页未列具体截止日期（待补）",
    "TOEFL iBT / IELTS Academic（最低分待补）",
    "Wagner bulletin 页未列标化要求（待补）",
    "Wagner bulletin 页未列打包学费（待补）",
    ["学位授予：MPA（公共管理硕士，45 credits）",
     "方向：卫生政策与管理（Health Policy and Management）",
     "Wagner 公共服务学院为全美顶尖公共政策学院之一",
     "跨学科：结合公共政策、卫生经济、卫生系统管理、社区健康"],
    ["核心议题：如何在降低成本的同时改善医疗可及性与质量",
     "关注社区健康与住房、交通、教育等社会决定因素的关联",
     "方向：卫生政策分析、卫生系统管理、全球卫生、卫生经济学",
     "与 NYU 医学院、公共卫生学院联合培养资源"],
    "Wagner bulletin 页 200 可达（131KB），项目描述与 45 credits 提取；公共管理类保守 stem:0；具体截止/语言最低分/标化/学费 bulletin 页未列，留待补。"
)))

for path, html in pages:
    with open(path, "w", encoding="utf-8") as f:
        f.write(html)
    print(f"WRITTEN {path} {len(html)}")
