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

TPL = """<!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 / __TITLE__</div>
<div class="card">
<h1>__TITLE__</h1>
<div class="meta"><span class="chip">__DEG__</span><span class="chip">北卡教堂山 UNC-Chapel Hill</span><span class="chip">__DISC__</span>__STEM_CHIP__<span class="chip">__DEPT__</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>catalog 页未列具体轮次（待补）</dd>
<dt>语言要求</dt><dd>TOEFL iBT / IELTS Academic（最低分待补）</dd>
<dt>标化考试</dt><dd>catalog 页未列（待补）</dd>
<dt>学费</dt><dd>catalog 页未列打包学费（待补）</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, deg, disc, stem, dept, url, core, elect, note):
    stem_chip = '<span class="chip">STEM（OPT 36 个月）</span>' if stem else ''
    return TPL.replace("__TITLE__", title).replace("__DEG__", deg).replace("__DISC__", disc).replace("__STEM_CHIP__", stem_chip).replace("__DEPT__", dept).replace("__URL__", url).replace("__CORE__", core).replace("__ELECT__", elect).replace("__NOTE__", note)

pages = []

# 1. UNC Cell Biology & Physiology MS (Biomedical Research)
pages.append(("details/unc-cbph-ms.html", build(
    "细胞生物学与生理学硕士（MS in Cell Biology & Physiology, Biomedical Research）",
    "MS", "sci", 1,
    "Department of Cell Biology & Physiology, School of Medicine",
    "https://catalog.unc.edu/graduate/schools-departments/cell-biology-physiology/",
    "<li>独立 direct admission terminal Master program（非 PhD 通道附带）</li><li>Biomedical Research 方向：2 学期课程 + 研究论文</li><li>核心研讨：CBPH 855/856 Career and Research Enhancement Seminar (CaRES)</li><li>Biomedical Research 方向：CBPH 850 Human Physiology I（4 学分）、CBPH 851 Human Physiology II（4 学分）</li><li>Master's Committee / Oral Exam / Thesis / Exit Survey 全套里程碑</li>",
    "<li>Biomedical Research 方向：面向生物医学研究职业，含实验室轮转与独立研究</li><li>另有 Physiology-Based (P.B.) 方向，为 MD/PhD 等医学专业学生设计，非独立招生硕士</li><li>Department 隶属 UNC School of Medicine，BBSP（Biological & Biomedical Sciences Program）博士前轮转</li><li>PhD 方向提供 stipend + tuition + fees + medical insurance 全包（硕士无资助信息，待补）</li>",
    "catalog 页未列具体学分总数/截止/语言/GRE/学费，整项待补；PB 方向面向医学专业学生，非独立硕士通道，未录；PhD in Cell Biology & Physiology 留批次5；Online/Part-time 无通道，本条为在校 full-time terminal MS。"
)))

# 2. UNC Environment-Ecology MS (E3P)
pages.append(("details/unc-enec-ms.html", build(
    "环境生态硕士（MS in Environment and Ecology, E3P）",
    "MS", "sci", 1,
    "Environment, Ecology and Energy (E3P) Interdisciplinary Program",
    "https://catalog.unc.edu/graduate/schools-departments/environment-ecology/",
    "<li>E3P 跨学科项目，整合多系资源</li><li>MS 需 independent research + thesis：minimum 30 hours（其中 ≥24 hours 课程 + ≥3 hours research）</li><li>核心：ENEC 567 / ENEC 569；ENEC 993 Master's Research and Thesis（3 hours）</li><li>One semester of registration required；Master's Committee / Exit Survey</li><li>All master's degrees are terminal degree（非 PhD 附带）</li>",
    "<li>研究方向：ecology / human ecology / environmental systems</li><li>跨系合作：Earth, Marine and Environmental Sciences；City and Regional Planning 等</li><li>另有 MA（Environment and Ecology）通道：要求 thesis question + literature research review（ENEC 992 paper），替代 MS thesis，可后续补录</li><li>PhD in E3P 留批次5</li>",
    "catalog 页未列具体课程列表/截止/语言/GRE/学费，整项待补；MA 通道（literature review paper）与 MS 通道（empirical thesis）并列，本条录 research 型 MS；PhD 留批次5；无 online/part-time 通道。"
)))

# 3. UNC Health Behavior MPH
pages.append(("details/unc-hbeh-mph.html", build(
    "健康行为公共卫生硕士（MPH in Health Behavior）",
    "MPH", "med", 0,
    "Department of Health Behavior, Gillings School of Global Public Health",
    "https://catalog.unc.edu/graduate/schools-departments/health-behavior/",
    "<li>Gillings 公卫学院 professional master，residential 在校版</li><li>Minimum 42 hours；SPHG Integrated Core：SPHG 711 Data Analysis for Public Health / 712 Methods and Measures / 721 Systems, Policy and Advocacy / 722 Developing, Implementing, Evaluating Public Health Solutions（含 Comprehensive Exam）</li><li>Practicum：SPHG 703 Pre-Practicum（0.5h）+ SPHG 707 Post-Practicum（0.5h）</li><li>Concentration 核心：HBEH 730 Theoretical Foundations of Health Behavior（3h）、HBEH 746 Community-Led Capstone Project（3h）、HBEH 750 Interpreting Health Behavior Research（2h）、HBEH 752 Health Behavior Surveys（2h）、HBEH 753 Qualitative Methods（3h）、HBEH 772 Planning, Implementing, Evaluating Health Behavior Interventions（2h）</li><li>Electives：≥9 hours graduate-level（Gillings 400+ / UNC 500+）</li><li>Culminating：HBEH 992 Master's Non-Thesis（3h）</li>",
    "<li>三方向可选：Health Behavior / Health Equity & Social Justice (EQUITY) / Global Health</li><li>Health Behavior 方向：#2 social and behavioral science program per USNews 2024</li><li>Community-partner 合作 capstone + mentored summer practicum</li><li>另有 MSPH-PhD 贯通项目（硕士到博士），留批次5；PhD in Health Behavior 需已有 MPH 或相关硕士，留批次5</li><li>Online MPH@UNC 为在线版，排除不录</li>",
    "catalog 页未列具体截止/语言/GRE/学费，整项待补；residential 在校版 2-step 申请：先 SOPHAS 再 UNC Graduate School；Online MPH@UNC 在线版排除；MSPH-PhD 贯通与 PhD 留批次5；Graduate Certificate in Total Worker Health 为证书，非学位，未录。"
)))

# 4. UNC Maternal and Child Health MPH
pages.append(("details/unc-mhch-mph.html", build(
    "妇幼健康公共卫生硕士（MPH in Maternal, Child and Family Health）",
    "MPH", "med", 0,
    "Department of Maternal and Child Health, Gillings School of Global Public Health",
    "https://catalog.unc.edu/graduate/schools-departments/maternal-child-health/",
    "<li>Gillings 公卫学院 professional master，residential 在校版</li><li>Minimum 42 hours；SPHG Integrated Core（同 Health Behavior MPH：711/712/721/722）</li><li>Practicum：SPHG 703/707</li><li>Concentration 核心：MHCH 701 Foundations of Maternal and Child Health I（3h）、MHCH 702 Foundations of Maternal and Child Health II（2h）、MHCH 713 Research Methods in MCH（3h）、MHCH 723 Monitoring and Evaluation of Global Health Programs（3h）、MHCH 728 Introduction to Implementation Research and Practice in MCH（3h）</li><li>Electives：≥9 hours graduate-level</li><li>Culminating：MHCH 992 Master's Non-Thesis（3h）</li>",
    "<li>MCFH（Maternal, Child and Family Health）方向：研究 women/children/family 健康决定因素、机制与系统</li><li>面向 practice career（公共卫生实践职业）</li><li>跨方向：Global Health 联合课程 MHCH 780 Cultural Humility（2h）</li><li>双学位通道（排除不录）：MPH-MSW（与 School of Social Work）、MPH-PharmD（与 Eshelman 药学院）</li><li>PhD in MCH 留批次5</li>",
    "catalog 页未列具体截止/语言/GRE/学费，整项待补；residential 在校版 2-step 申请（SOPHAS + UNC）；双学位 MPH-MSW / MPH-PharmD 按排除口径不录；Online MPH@UNC 在线版排除；PhD 留批次5。"
)))

# 5. UNC Nutrition MPH (Dietetics)
pages.append(("details/unc-nutrition-mph.html", build(
    "营养学公共卫生硕士-营养师方向（MPH in Nutrition, Nutrition & Dietetics）",
    "MPH", "med", 0,
    "Department of Nutrition, Gillings School of Global Public Health",
    "https://catalog.unc.edu/graduate/schools-departments/nutrition/",
    "<li>Gillings 公卫学院 professional master，residential 在校版（Nutrition & Dietetics 方向）</li><li>Minimum 42 hours；SPHG Integrated Core（711/712/721/722）</li><li>Practicum：NUTR 701 Nutrition Practicum Preparation（2h）+ 200 hours minimum practicum（含 Clinical Nutrition Field Experience / Public Health Nutrition Management Field Experience / Advanced Nutrition Placement，跨 Summer 1 & Summer 2）</li><li>Concentration 核心：NUTR 709 Medical Nutrition Therapy I（3h）、NUTR 712 Nutrition Communication, Counseling and Culture（3h）、NUTR 714 Nutritional Biochemistry, Metabolism and Health（3h）、NUTR 715 Medical Nutrition Therapy II（4h）、NUTR 723 Community Nutrition（3h）、NUTR 760/760L Food Science and Food Science Lab</li><li>Culminating：NUTR 992 Master's Non-Thesis（3h）</li>",
    "<li>Nutrition & Dietetics 方向：含临床营养学实习，可注册 RDN（Registered Dietitian Nutritionist）路径</li><li>另有 Nutrition, Food Systems and Health (NFSH) 方向：on-campus and online，在线版排除不录；在校 on-campus NFSH 方向可后续补录</li><li>已录 unc-nutrition-ms（研究型 MS，laboratory/population-based research），本条为 professional 型 MPH-Dietetics，独立项目不重复</li><li>B.S.P.H. + M.S. 本硕连读（本校本科加速），排除不录</li><li>PhD in Nutrition 留批次5</li>",
    "catalog 页未列具体截止/语言/GRE/学费，整项待补；DICAS 申请通道（Nutrition & Dietetics 专用）；Online MPH@UNC 与 NFSH 在线版排除；B.S.PH.+M.S. 本硕连读排除；PhD 留批次5；与已录 unc-nutrition-ms 为不同项目（研究型 vs 专业型），不重复。"
)))

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