# -*- 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, crumb, title, h1, deg_chip, disc_chip, college_chip, dept, url, ddl, lang, test, tui, core_items, elect_items, note):
    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> / {school_cn} / {title}</div>
<div class="card">
<h1>{h1}</h1>
<div class="meta"><span class="chip">{deg_chip}</span><span class="chip">{school_cn} New York University</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_items}</ul></div>
<div class="card"><h2>方向选修 / 特色</h2><ul>{elect_items}</ul></div>
<div class="card"><h2>备注</h2><div class="note">{note}</div></div>
</div></body></html>"""

pages = []

# 1. NYU Mathematics MS
pages.append(("details/nyu-cc46aa8.html", build(
    "纽约大学", "数学硕士（MS）", "数学硕士", "数学硕士（MS in Mathematics）",
    "MS", "sci", "文理学院 GSAS · Courant 数学研究所",
    "Department of Mathematics, Courant Institute",
    "https://bulletins.nyu.edu/graduate/arts-science/programs/mathematics-ms/",
    "GSAS bulletin 页未列具体截止日期（待补）",
    "TOEFL iBT / IELTS Academic（最低分待补）",
    "GSAS bulletin 页未列标化要求（待补）",
    "GSAS bulletin 页未列打包学费（待补）",
    "<li>学位授予：MS（数学硕士）</li><li>方案一：36 学分课程 + 笔试综合考试（comprehensive examination，成绩至少 B）</li><li>方案二：32 学分课程 + 硕士论文（master's thesis，导师指导并经系里批准）</li><li>两种方案均可转最多 8 学分（通常来自其他经认证院校）</li><li>面向想从事研究或进一步攻读 PhD 的学生</li>",
    "<li>方向：微分方程、代数、应用数学、金融数学</li><li>课程由 Courant 数学研究所教授授课，涵盖纯数学与应用数学</li><li>学生可参与研究课题，与教授合作解决数学问题</li><li>CIP 27.0101（数学），HEGIS 1701.00</li>",
    "bulletins.nyu.edu 200 可达（44KB）；数学/STEM 类标 stem:1；具体截止/语言最低分/标化/学费 GSAS 页未列，留待补。"
)))

# 2. NYU Economics MA
pages.append(("details/nyu-c529fb8.html", build(
    "纽约大学", "经济学硕士（MA）", "经济学硕士", "经济学硕士（MA in Economics）",
    "MA", "soc", "文理学院 GSAS",
    "Department of Economics",
    "https://bulletins.nyu.edu/graduate/arts-science/programs/economics-ma/",
    "GSAS bulletin 页未列具体截止日期（待补）",
    "TOEFL iBT / IELTS Academic（最低分待补）",
    "GSAS bulletin 页未列标化要求（待补）",
    "GSAS bulletin 页未列打包学费（待补）",
    "<li>学位授予：MA（经济学文学硕士）</li><li>全日制至少 3 个学期</li><li>全日制与非全日制学生均接收，学位完成最长 5 年</li><li>录取面向优秀潜质学生（outstanding promise）</li><li>课程涵盖微观经济学、宏观经济学、计量经济学核心</li>",
    "<li>课程为 PhD 阶段做准备，也适合就业导向学生</li><li>可与 NYU 其他学院修双学位（Dual Degrees）</li><li>CIP 45.0603（经济学），HEGIS 2204.00</li>",
    "bulletins.nyu.edu 200 可达（37KB）；经济学属社科类保守 stem:0；具体截止/语言最低分/标化/学费 GSAS 页未列，留待补。"
)))

# 3. NYU Physics MS
pages.append(("details/nyu-c4815f8.html", build(
    "纽约大学", "物理学硕士（MS）", "物理学硕士", "物理学硕士（MS in Physics）",
    "MS", "sci", "文理学院 GSAS",
    "Department of Physics",
    "https://bulletins.nyu.edu/graduate/arts-science/programs/physics-ms/",
    "GSAS bulletin 页未列具体截止日期（待补）",
    "TOEFL iBT / IELTS Academic（最低分待补）",
    "GSAS bulletin 页未列标化要求（待补）",
    "GSAS bulletin 页未列打包学费（待补）",
    "<li>学位授予：MS（物理学硕士）</li><li>Option A：36 学分课程 + Report（基于专业领域文献的综述文章，导师指导下完成）</li><li>另有 Option B/C 供选择（详见 bulletin）</li><li>课程涵盖经典力学、量子力学、电动力学、统计物理等核心</li>",
    "<li>方向：凝聚态物理、高能物理、天体物理、生物物理等</li><li>学生可参与系里研究组工作</li><li>CIP 40.0801（物理），HEGIS 1902.00</li>",
    "bulletins.nyu.edu 200 可达（38KB）；物理科学类标 stem:1；具体截止/语言最低分/标化/学费 GSAS 页未列，留待补。"
)))

# 4. NYU Psychology MA
pages.append(("details/nyu-c897195.html", build(
    "纽约大学", "心理学硕士（MA）", "心理学硕士", "心理学硕士（MA in Psychology）",
    "MA", "soc", "文理学院 GSAS",
    "Department of Psychology",
    "https://bulletins.nyu.edu/graduate/arts-science/programs/psychology-ma/",
    "GSAS bulletin 页未列具体截止日期（待补）",
    "TOEFL iBT / IELTS Academic（最低分待补）",
    "GSAS bulletin 页未列标化要求（待补）",
    "GSAS bulletin 页未列打包学费（待补）",
    "<li>学位授予：MA（心理学文学硕士）</li><li>共 36 学分（其中至少 24 学分须在 NYU 校内完成）</li><li>毕业要求：笔试综合考试（comprehensive examination）或硕士论文（master's thesis）二选一</li><li>必修：PSYCH-GA 2016 Masters Statistics（或同等课程）</li><li>核心课程成绩须达到 B 以上</li>",
    "<li>方向：认知心理学、社会心理学、认知神经科学、工业与组织心理学等</li><li>课程为继续攻读 PhD 或相关职业做准备</li><li>CIP 42.2799（心理学），HEGIS 2001.00</li>",
    "bulletins.nyu.edu 200 可达（38KB）；心理学属社科类保守 stem:0；具体截止/语言最低分/标化/学费 GSAS 页未列，留待补。"
)))

# 5. NYU Biology MS
pages.append(("details/nyu-ccb0e04.html", build(
    "纽约大学", "生物学硕士（MS）", "生物学硕士", "生物学硕士（MS in Biology）",
    "MS", "sci", "文理学院 GSAS",
    "Department of Biology",
    "https://bulletins.nyu.edu/graduate/arts-science/programs/biology-ms/",
    "GSAS bulletin 页未列具体截止日期（待补）",
    "TOEFL iBT / IELTS Academic（最低分待补）",
    "GSAS bulletin 页未列标化要求（待补）",
    "GSAS bulletin 页未列打包学费（待补）",
    "<li>学位授予：MS（生物学硕士）</li><li>共 36 学分：24 学分 BIOL-GA 核心课 + 12 学分选修课</li><li>毕业要求：须提交 qualifying paper（即硕士论文 thesis）</li><li>核心课示例：Bio Core I: Molecular Systems（4学分）/ Bio Core II: Cellular Systems（4学分）/ Emerging Pathogens / Programming for Biologists / Immunobiology</li><li>选修课可在 Biomaterials / Basic Medical Sciences / Environmental Health / Chemistry 等系修读</li>",
    "<li>方向：细胞生物学、分子生物学、微生物学、生理学、神经生物学、免疫学、遗传学、基因组学、系统生物学</li><li>提供现代生物学广泛基础，衔接 PhD 或生物行业就业</li><li>CIP 26.0101（生物学），HEGIS 0401.00</li>",
    "bulletins.nyu.edu 200 可达（32KB）；生物科学类标 stem:1；具体截止/语言最低分/标化/学费 GSAS 页未列，留待补。"
)))

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