# -*- 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")

HEAD = """<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><title>__TITLE__ | 北卡教堂山 | 美加硕博项目库</title><style>
:root{--bg:#f7f8fa;--card:#fff;--pri:#c8102e;--pri2:#a00d24;--line:#e5e7eb;--txt:#1f2937;--sub:#6b7280;--chip:#fef2f2;--link:#c8102e;}
*{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}
</style></head><body><div class="wrap">
<div class="crumb"><a href="../index_main.html">← 返回项目库</a> / 北卡教堂山 UNC-Chapel Hill / __CRUMB__</div>
<div class="card">
<h1>__H1__</h1>
<div class="meta">__CHIPS__</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>
"""

def build(title, crumb, h1, chips, dept, url, ddl, lang, test, tui, core, elect, note):
    s = HEAD
    for k,v in [("__TITLE__",title),("__CRUMB__",crumb),("__H1__",h1),("__CHIPS__",chips),
                ("__DEPT__",dept),("__URL__",url),("__DDL__",ddl),("__LANG__",lang),
                ("__TEST__",test),("__TUI__",tui),("__CORE__",core),("__ELECT__",elect),("__NOTE__",note)]:
        s = s.replace(k,v)
    return s

pages = []

# 1. Chemistry MS
pages.append(("details/unc-chemistry-ms.html", build(
    title="化学硕士（MS Chemistry）",
    crumb="化学硕士（MS Chemistry）",
    h1="化学硕士（MS in Chemistry, Thesis）",
    chips='<span class="chip">MS</span><span class="chip">北卡教堂山 UNC-Chapel Hill</span><span class="chip">sci</span><span class="chip">STEM（OPT 36 个月）</span><span class="chip">Department of Chemistry</span>',
    dept="Department of Chemistry",
    url="https://catalog.unc.edu/graduate/schools-departments/chemistry/",
    ddl="catalog 页未列具体轮次（待补）",
    lang="TOEFL iBT / IELTS Academic（最低分待补）",
    test="catalog 页未列（待补）",
    tui="catalog 页未列打包学费（待补）",
    core="<li>提供 master of arts (non-thesis) 与 master of science (thesis) 两个学位通道；本条录研究型 MS (thesis)</li><li>研究方向：analytical / biological / inorganic / organic / physical / polymer and materials chemistry</li><li>与 Physics & Astronomy、Biochemistry & Biophysics、Environmental Science and Engineering、Biological and Biomedical Sciences Program 有密切交叉合作</li>",
    elect="<li>Analytical：超高压毛细管液相、毛细管电泳、二维分离、质谱、电分析化学、化学微系统（lab-on-a-chip）、纳米流体单分子 DNA 测序、聚合物膜传感器</li><li>Biological：结构-功能关系、化学生物学、生物物理、蛋白质折叠、RNA 结构、蛋白质工程、非天然氨基酸突变</li><li>Polymer & Materials：聚合物与材料化学</li>",
    note="catalog 页未列具体学分/课程列表/截止/语言/GRE/学费，整项待补；MA (non-thesis) 为授课型硕士，可后续补录；PhD in Chemistry 为研究型博士，留批次5。"
)))

# 2. HPM MSPH
pages.append(("details/unc-hpm-msph.html", build(
    title="卫生政策与管理研究型公卫硕士（MSPH）",
    crumb="卫生政策与管理研究型公卫硕士（MSPH）",
    h1="卫生政策与管理研究型公卫硕士（MS in Public Health, Health Policy & Management）",
    chips='<span class="chip">MSPH</span><span class="chip">北卡教堂山 UNC-Chapel Hill</span><span class="chip">med</span><span class="chip">Gillings School of Global Public Health</span>',
    dept="Department of Health Policy and Management, Gillings School of Global Public Health",
    url="https://catalog.unc.edu/graduate/schools-departments/health-policy-management/",
    ddl="catalog 页未列具体轮次（待补）",
    lang="TOEFL iBT / IELTS Academic（最低分待补）",
    test="catalog 页未列（待补）",
    tui="catalog 页未列打包学费（待补）",
    core="<li>学位授予：MSPH（研究型）、MHA（医疗管理 professional）、MPH（卫生政策方向）、PhD、DrPH</li><li>本条录研究型 MSPH；MHA / MPH 卫生政策方向可后续补录</li><li>研究方向：aging services and supports / behavioral health / cancer care / global health / health care delivery and payment / health equity and access / rural health</li>",
    elect="<li>与 Kenan-Flagler Business School、School of Information and Library Science、Law School 提供多个 dual degree</li><li>社区准备与灾害管理 graduate certificate</li><li>MPH 学生可与 School of Social Work、City and Regional Planning、Eshelman School of Pharmacy、Law School 双学位</li>",
    note="catalog 页未列具体学分/课程列表/截止/语言/GRE/学费，整项待补；STEM 状态 catalog 页未明示，保守 stem:0；PhD/DrPH 留批次5。"
)))

# 3. Epidemiology MS
pages.append(("details/unc-epi-ms.html", build(
    title="流行病学硕士（MS Epidemiology）",
    crumb="流行病学硕士（MS Epidemiology）",
    h1="流行病学硕士（MS in Epidemiology, Research）",
    chips='<span class="chip">MS</span><span class="chip">北卡教堂山 UNC-Chapel Hill</span><span class="chip">med</span><span class="chip">Gillings School of Global Public Health</span>',
    dept="Department of Epidemiology, Gillings School of Global Public Health",
    url="https://catalog.unc.edu/graduate/schools-departments/epidemiology/",
    ddl="catalog 页未列具体轮次（待补）",
    lang="TOEFL iBT / IELTS Academic（最低分待补）",
    test="catalog 页未列（待补）",
    tui="catalog 页未列打包学费（待补）",
    core="<li>提供 master's 与 doctoral 学位，及 cosponsored certificate</li><li>master's 项目训练流行病学研究方法，与 faculty 共同开展 key research questions</li><li>研究疾病终点：cancer / cardiovascular / infectious disease / injury / reproductive-perinatal-pediatric epidemiology</li><li>影响因素与方法：environmental / occupational / pharmacoepidemiology / genetic / social / methods</li>",
    elect="<li>与北卡本地及全球健康问题结合，classroom 与 real-world 教育跨学科</li><li>另有 MS in Clinical Research (MSCR)：面向已持 MD/PharmD/PhD/DDS/DVM 或 RN/PA 且已在 UNC/Duke 担任 resident/clinical fellow/postdoc/junior faculty 的 physician-scientist，36cr，两年 in residence——不符合应届生招生对象，排除</li>",
    note="catalog 页未列具体学分/课程列表/截止/语言/GRE/学费，整项待补；STEM 状态 catalog 页未明示，保守 stem:0；PhD in Epidemiology 留批次5。"
)))

# 4. Nutrition MS
pages.append(("details/unc-nutrition-ms.html", build(
    title="营养科学硕士（MS Nutrition）",
    crumb="营养科学硕士（MS Nutrition）",
    h1="营养科学硕士（MS in Nutrition, Research）",
    chips='<span class="chip">MS</span><span class="chip">北卡教堂山 UNC-Chapel Hill</span><span class="chip">med</span><span class="chip">Gillings School of Global Public Health</span>',
    dept="Department of Nutrition, Gillings School of Global Public Health",
    url="https://catalog.unc.edu/graduate/schools-departments/nutrition/",
    ddl="catalog 页未列具体轮次（待补）",
    lang="TOEFL iBT / IELTS Academic（最低分待补）",
    test="catalog 页未列（待补）",
    tui="catalog 页未列打包学费（待补）",
    core="<li>UNC Gillings 营养系是美国唯一同时设在公共卫生学院与医学院的营养系，研究跨度从 cell to society</li><li>MS (Research)：面向希望深化营养科学知识、从事实验室和/或人群研究、或进入工业界的学生</li><li>另有 MPH：Nutrition, Food Systems and Health 与 Nutrition and Dietetics（含 Dietetic 实习，毕业后可考 CDR 注册营养师 RDN）</li>",
    elect="<li>Nutrition and Dietetics 方向先修要求：Chemistry 1/2、Organic Chemistry、Biochemistry、Human Anatomy、Human Physiology、Microbiology with Lab、Human Nutrition、General Psychology、Intro to Anthropology or Sociology</li><li>研究网络覆盖中国、印度、马拉维、西班牙、菲律宾等</li>",
    note="catalog 页未列具体学分/课程列表/截止/语言/GRE/学费，整项待补；STEM 状态 catalog 页未明示，保守 stem:0；MPH Nutrition 可后续补录；PhD in Nutrition 留批次5。"
)))

# 5. Political Science TAM MA
pages.append(("details/unc-polisci-tam-ma.html", build(
    title="政治学跨大西洋双硕士（MA TAM）",
    crumb="政治学跨大西洋双硕士（MA TAM）",
    h1="政治学文学硕士（MA in Political Science, TransAtlantic Masters Program）",
    chips='<span class="chip">MA</span><span class="chip">北卡教堂山 UNC-Chapel Hill</span><span class="chip">soc</span><span class="chip">Department of Political Science</span>',
    dept="Department of Political Science, TransAtlantic Masters (TAM) Program",
    url="https://catalog.unc.edu/graduate/schools-departments/political-science/",
    ddl="12/1 优先，不晚于 posted deadline（页面公布）",
    lang="TOEFL iBT / IELTS Academic（Graduate School 要求，waiver 另审）",
    test="GRE required",
    tui="catalog 页未列打包学费（待补）",
    core="<li>UNC 政治学系博士路径为主；terminal 硕士通过 TransAtlantic Masters (TAM) 项目提供</li><li>TAM 为跨大西洋双硕士：一年在 UNC，一年在欧洲合作校，授予 MA</li><li>先修：本科 BA 或同等学位；不要求本科为政治学，但通常需至少 9 学期学时政治学课程</li><li>申请材料：writing sample、statement of purpose、3 封推荐信</li>",
    elect="<li>TAM 合作欧洲校：涵盖欧洲主要研究型大学，具体校单与欧洲年方向以项目官网为准</li><li>面向国际关系、比较政治、欧洲研究方向学生</li>",
    note="catalog 页未列具体学分/课程列表/学费，整项待补；GRE required 为页面明示；ddl 12/1 优先为页面明示；TAM 为独立招生的 terminal MA（非 PhD 通道附带），但属小众双硕士项目，业务价值一般；常规 PhD in Political Science 为主流，留批次5。"
)))

for path, html in pages:
    open(path, "w", encoding="utf-8").write(html)
    print("WROTE", path, len(html))
