# -*- 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> / 多伦多大学 University of Toronto / __BREAD__</div>
<div class="card">
<h1>__H1__</h1>
<div class="meta"><span class="chip">__DEG__</span><span class="chip">多伦多大学 UofT</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>__DDL__</dd>
<dt>语言要求</dt><dd>__LANG__</dd>
<dt>标化考试</dt><dd>__TEST__</dd>
<dt>学费</dt><dd>SGS 页未列打包学费（待补）</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/ut-c7a2833.html",
        "title": "可持续管理硕士（MScSM）",
        "bread": "可持续管理硕士（MScSM）",
        "h1": "可持续管理硕士（Master of Science in Sustainability Management, MScSM）",
        "deg": "MScSM",
        "disc": "biz",
        "college": "密西沙加校区（UTM）",
        "dept": "School of Graduate Studies, Graduate Unit: Management & Innovation",
        "url": "https://www.sgs.utoronto.ca/programs/sustainability-management/",
        "ddl": "SGS 页未列具体轮次（待补）",
        "lang": "TOEFL iBT / IELTS Academic（最低分待补）",
        "test": "SGS 页未列（待补）",
        "core": "<li>学位授予：MScSM（professional / research-based）</li><li>最低录取平均分：mid B (3.0/4.0)</li><li>Direct entry from bachelor to PhD: NA（独立 terminal master）</li><li>Supervisor: NA（course-based / professional）</li>",
        "elect": "<li>跨学科训练：整合环境科学、政策、商业与可持续发展</li><li>面向 sustainability-related divisions and organizations 的管理职业方向</li><li>Graduate Unit: Management & Innovation（UTM）</li>",
        "note": "SGS 页给 Quick Facts（mid B 3.0），但具体学分/课程列表/截止/语言分/GRE/学费未列，待补；加拿大项目一律 stem:0；管理类专业型硕士。",
    },
    {
        "file": "details/ut-c900110.html",
        "title": "法务会计硕士（MFAcc）",
        "bread": "法务会计硕士（MFAcc）",
        "h1": "法务会计硕士（Master of Forensic Accounting, MFAcc）",
        "deg": "MFAcc",
        "disc": "biz",
        "college": "密西沙加校区（UTM）",
        "dept": "School of Graduate Studies, Graduate Unit: Management & Innovation",
        "url": "https://www.sgs.utoronto.ca/programs/forensic-accounting/",
        "ddl": "SGS 页未列具体轮次（待补）",
        "lang": "TOEFL iBT / IELTS Academic（最低分待补）",
        "test": "SGS 页未列（待补）",
        "core": "<li>学位授予：MFAcc（professional）</li><li>最低录取平均分：Mid-B in final year of undergraduate degree</li><li>面向法务会计、调查审计、网络犯罪与影子银行系统领域</li><li>Graduate Unit: Management & Innovation（UTM）</li>",
        "elect": "<li>课程涵盖 cybercrime、shadow banking、financial investigation、litigation support</li><li>为特许专业会计师（CPA）/ 法务会计职业方向设计</li><li>跨学科：会计 + 法律 + 计算机取证</li>",
        "note": "SGS 页给 Quick Facts（Mid-B），但具体学分/课程列表/截止/语言分/GRE/学费未列，待补；加拿大项目一律 stem:0；会计类专业型硕士。",
    },
    {
        "file": "details/ut-c4f263b.html",
        "title": "应用计算硕士（MScAC）",
        "bread": "应用计算硕士（MScAC）",
        "h1": "应用计算硕士（Master of Science in Applied Computing, MScAC）",
        "deg": "MScAC",
        "disc": "cs",
        "college": "文理学院（A&S）",
        "dept": "School of Graduate Studies, Department of Computer Science",
        "url": "https://www.sgs.utoronto.ca/programs/applied-computing/",
        "ddl": "SGS 页未列具体轮次（待补）",
        "lang": "TOEFL iBT / IELTS Academic（最低分待补）",
        "test": "GRE recommended for applicants without a Canadian university degree",
        "core": "<li>学位授予：MScAC（research-based，supervisor 先分配）</li><li>最低录取平均分：B+ in final year of Bachelor's</li><li>Direct entry from bachelor to PhD: No</li><li>Supervisor identified before admission（graduate unit 分配）</li>",
        "elect": "<li>面向 world-class innovators，强调应用计算与产业创新</li><li>Concentration 方向：AI / 机器学习 / 数据科学 / 分布式系统等</li><li>与 Rotman 商学院共享部分管理类选修</li>",
        "note": "SGS 页给 Quick Facts（B+，GRE recommended for non-Canadian degree），但具体学分/课程列表/截止/语言分/学费未列，待补；CS 类按 STEM 口径标 stem:1；加拿大项目 stem:1 仅适用于工程/CS 类（SGS 未明示但按 STEM OPT 口径）。",
    },
    {
        "file": "details/ut-c027862.html",
        "title": "生物医学传播硕士（MScBMC）",
        "bread": "生物医学传播硕士（MScBMC）",
        "h1": "生物医学传播硕士（Master of Science in Biomedical Communications, MScBMC）",
        "deg": "MScBMC",
        "disc": "med",
        "college": "Temerty 医学院",
        "dept": "School of Graduate Studies, Institute of Medical Science",
        "url": "https://www.sgs.utoronto.ca/programs/biomedical-communications/",
        "ddl": "SGS 页未列具体轮次（待补）",
        "lang": "IELTS 7.5 overall（6.5 each component）；TOEFL 600 paper-based + 5 TWE",
        "test": "SGS 页未列（待补）",
        "core": "<li>学位授予：MScBMC（two-year professional / research-based）</li><li>最低录取平均分：Mid-B in final two years of four-year bachelor's degree</li><li>Direct entry from bachelor to PhD: N/A</li><li>Supervisor: N/A（course-based professional）</li>",
        "elect": "<li>加拿大唯一、全球仅5所认证的生物医学传播项目之一</li><li>课程：医学插画、动画、医学可视化、科学传播</li><li>跨学科：医学 + 艺术 + 计算机图形学</li>",
        "note": "SGS 页给 Quick Facts（Mid-B，IELTS 7.5/6.5，TOEFL 600+5 TWE），但具体学分/课程列表/截止/GRE/学费未列，待补；生物医学信息类按 STEM 口径标 stem:1；保留类（生物医学信息/医疗信息）。",
    },
    {
        "file": "details/ut-ca0f935.html",
        "title": "数学金融硕士（MMF）",
        "bread": "数学金融硕士（MMF）",
        "h1": "数学金融硕士（Master of Mathematical Finance, MMF）",
        "deg": "MMF",
        "disc": "biz",
        "college": "文理学院（A&S）",
        "dept": "School of Graduate Studies, Graduate Unit: Mathematics",
        "url": "https://www.sgs.utoronto.ca/programs/mathematical-finance/",
        "ddl": "SGS 页未列具体轮次（待补）",
        "lang": "TOEFL iBT / IELTS Academic（最低分待补）",
        "test": "SGS 页未列（待补）",
        "core": "<li>学位授予：MMF（professional）</li><li>数学金融专业硕士，面向量化金融职业方向</li><li>SGS 页列 Quick Facts（具体录取平均分待提取）</li><li>Graduate Unit: Mathematics / Statistics cross-disciplinary</li>",
        "elect": "<li>核心课程：随机微积分、金融数学、衍生品定价、风险管理、数值方法</li><li>与 Rotman 商学院、Fields Institute 合作</li><li>Co-op / internship 机会（待 SGS 页确认）</li>",
        "note": "SGS 页 200 可达（442KB），Quick Facts 具体数值本轮未完整提取，待下轮补核；数学金融按 STEM 口径标 stem:1；金融类专业型硕士；加拿大项目 stem:1 按 STEM OPT 口径。",
    },
]

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("__DDL__", p["ddl"])
    html = html.replace("__LANG__", p["lang"])
    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"])
