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

TEMPLATE = '''<!doctype html><html lang="zh-CN"><head><meta charset="utf-8"><title>__TITLE__ | 约翰霍普金斯 | 美加硕博项目库</title><style>
: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}}
</style></head><body><div class="wrap">
<div class="crumb"><a href="../index_main.html">← 返回项目库</a> / 约翰霍普金斯 Johns Hopkins / __BREAD__</div>
<div class="card">
<h1>__H1__</h1>
<div class="meta"><span class="chip">__DEG__</span><span class="chip">约翰霍普金斯 JHU</span><span class="chip">__DISC__</span><span class="chip">__COLLEGE__</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>e-catalogue 页未列具体轮次（待补）</dd>
<dt>语言要求</dt><dd>TOEFL iBT / IELTS Academic（最低分待补）</dd>
<dt>标化考试</dt><dd>__TEST__</dd>
<dt>学费</dt><dd>e-catalogue 页未列打包学费（待补）</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 = [
    {
        "file": "details/jhu-c97be4c.html",
        "title": "应用经济学硕士（MS）",
        "bread": "应用经济学硕士（MS）",
        "h1": "应用经济学硕士（Master of Science in Applied Economics）",
        "deg": "MS",
        "disc": "soc",
        "college": "Krieger 文理学院（AAP）",
        "dept": "Advanced Academic Programs, Krieger School of Arts and Sciences",
        "url": "https://e-catalogue.jhu.edu/arts-sciences/advanced-academic-programs/programs/applied-economics-master-science/",
        "test": "e-catalogue 页未列（待补）",
        "core": "<li>学位授予：MS in Applied Economics</li><li>总课程：11 门（3 门必修核心 + 8 门选修）</li><li>核心必修：AS.440.601 Microeconomic Theory / AS.440.602 Macroeconomics / AS.440.603 Econometrics I</li><li>入学要求：bachelor's degree，接受所有本科专业背景</li>",
        "elect": "<li>选修方向：Finance / Health Economics / International Economics / Development Economics / Data Analytics</li><li>提供 graduate certificate 叠加：Investment / Finance / Health Economics / Global Food Security</li><li>课程可 onsite in Washington D.C.、online 或 hybrid 混合修读</li>",
        "note": "AAP 继续教育学院项目，onsite/online/hybrid 混合；本条录 onsite 版本，纯在线版排除；e-catalogue 页列课程结构与核心课，截止/语言/GRE/学费未列待补；STEM 状态未明示，保守 stem:0；经济类。",
    },
    {
        "file": "details/jhu-c5ed8dc.html",
        "title": "生物信息学硕士（MS）",
        "bread": "生物信息学硕士（MS）",
        "h1": "生物信息学硕士（Master of Science in Bioinformatics）",
        "deg": "MS",
        "disc": "cs",
        "college": "Krieger 文理学院（AAP / Center for Biotechnology Education）",
        "dept": "Center for Biotechnology Education, Advanced Academic Programs",
        "url": "https://e-catalogue.jhu.edu/arts-sciences/advanced-academic-programs/programs/center-biotechnology-education/bioinformatics-master-science/",
        "test": "e-catalogue 页未列（待补）",
        "core": "<li>学位授予：MS in Bioinformatics（thesis-optional）</li><li>总课程：11 门</li><li>核心必修：AS.410.602 Molecular Biology / AS.410.610 Epigenetics, Gene Organization &amp; Expression 等</li><li>入学要求：bachelor's degree，偏好 quantitative background</li>",
        "elect": "<li>可选 independent study project（thesis optional）</li><li>课程可 part-time or full-time 修读，onsite / online / 混合</li><li>与 Biotechnology 方向共享 Center for Biotechnology Education 课程资源</li>",
        "note": "AAP Center for Biotechnology Education 项目，onsite/online/hybrid 混合；本条录 onsite 版本，纯在线版排除；e-catalogue 页列课程结构，截止/语言/GRE/学费未列待补；生物信息学按 STEM 口径标 stem:1；保留类（生物医学信息）。",
    },
    {
        "file": "details/jhu-c726156.html",
        "title": "文化遗产管理文学硕士（MA）",
        "bread": "文化遗产管理文学硕士（MA）",
        "h1": "文化遗产管理文学硕士（Master of Arts in Cultural Heritage Management）",
        "deg": "MA",
        "disc": "art",
        "college": "Krieger 文理学院（AAP）",
        "dept": "Advanced Academic Programs, Krieger School of Arts and Sciences",
        "url": "https://e-catalogue.jhu.edu/arts-sciences/advanced-academic-programs/programs/cultural-heritage-management-master-arts/",
        "test": "e-catalogue 页未列（待补）",
        "core": "<li>学位授予：MA in Cultural Heritage Management</li><li>总课程：6 学分核心 seminar + 4 门选修</li><li>核心必修：AS.465.702 Studies in World Heritage / AS.465.704 Cultural Heritage Management/Leadership 等</li><li>入学要求：bachelor's degree</li>",
        "elect": "<li>可选 graduate certificate 叠加：Nonprofit Management / Digital Curation</li><li>跨学科：博物馆学、文物保护、世界遗产、非营利管理</li><li>课程可 onsite in Washington D.C.、online 或 hybrid</li>",
        "note": "AAP 继续教育学院人文类项目，onsite/online/hybrid 混合；本条录 onsite 版本，纯在线版排除；e-catalogue 页列课程结构，截止/语言/GRE/学费未列待补；STEM 状态未明示，保守 stem:0；人文艺术类冷门。",
    },
    {
        "file": "details/jhu-c13629c.html",
        "title": "金融经济学硕士（MS）",
        "bread": "金融经济学硕士（MS）",
        "h1": "金融经济学硕士（Master of Science in Financial Economics）",
        "deg": "MS",
        "disc": "biz",
        "college": "Krieger 文理学院（AAP）",
        "dept": "Advanced Academic Programs, Krieger School of Arts and Sciences",
        "url": "https://e-catalogue.jhu.edu/arts-sciences/advanced-academic-programs/programs/financial-economics-master-science/",
        "test": "e-catalogue 页未列（待补）",
        "core": "<li>学位授予：MS in Financial Economics</li><li>总课程：10 门（4 门必修核心 + 6 门选修）</li><li>核心必修：AS.440.601 Microeconomic Theory / AS.440.602 Macroeconomics / AS.440.603 Econometrics I 等</li><li>入学要求：bachelor's degree，接受所有本科专业背景</li>",
        "elect": "<li>选修方向：投资学、公司金融、金融计量、风险管理、国际金融</li><li>课程可 part- or full-time，onsite in Washington D.C.、online 或 hybrid</li><li>为 working professionals 和 full-time students 设计</li>",
        "note": "AAP 继续教育学院金融类项目，onsite/online/hybrid 混合；本条录 onsite 版本，纯在线版排除；e-catalogue 页列课程结构，截止/语言/GRE/学费未列待补；STEM 状态未明示，保守 stem:0；商科类。",
    },
    {
        "file": "details/jhu-c785e3d.html",
        "title": "地理信息系统硕士（MS）",
        "bread": "地理信息系统硕士（MS）",
        "h1": "地理信息系统硕士（Master of Science in Geographic Information Systems）",
        "deg": "MS",
        "disc": "cs",
        "college": "Krieger 文理学院（AAP）",
        "dept": "Advanced Academic Programs, Krieger School of Arts and Sciences",
        "url": "https://e-catalogue.jhu.edu/arts-sciences/advanced-academic-programs/programs/geographic-information-systems-master-science/",
        "test": "e-catalogue 页未列（待补）",
        "core": "<li>学位授予：MS in Geographic Information Systems</li><li>总课程：1 门 capstone + 3 门 customizable 核心 + 6 门选修</li><li>Capstone：AS.430.800 Capstone for Geographic Information Systems</li><li>入学要求：bachelor's degree</li>",
        "elect": "<li>选修方向：空间分析、遥感、地理空间数据科学、地图学、空间编程</li><li>提供 post-baccalaureate certificate 选项</li><li>与 Environmental Sciences and Policy MS 有 GIS graduate certificate 交叉</li>",
        "note": "AAP 继续教育学院 GIS 项目；e-catalogue 页列课程结构与 capstone，截止/语言/GRE/学费未列待补；GIS 按 STEM 口径标 stem:1；on-campus/online 混合，本条录 onsite 版本。",
    },
]

for p in pages:
    html = TEMPLATE.replace("__TITLE__", p["title"])
    html = html.replace("__BREAD__", p["bread"])
    html = html.replace("__H1__", p["h1"])
    html = html.replace("__DEG__", p["deg"])
    html = html.replace("__DISC__", p["disc"])
    html = html.replace("__COLLEGE__", p["college"])
    html = html.replace("__DEPT__", p["dept"])
    html = html.replace("__URL__", p["url"])
    html = html.replace("__TEST__", p["test"])
    html = html.replace("__CORE__", p["core"])
    html = html.replace("__ELECT__", p["elect"])
    html = html.replace("__NOTE__", p["note"])
    with open(p["file"], "w", encoding="utf-8") as f:
        f.write(html)
    print("written:", p["file"])
