# -*- coding: utf-8 -*- """ 博客构建脚本:blog/posts/*.md -> website/static/blog/(列表 + 文章页)+ website/static/home.html(首页) front matter 格式: --- title: 文章标题 date: 2026-08-13 tags: 工业软件, ResLib --- """ import re import sys from datetime import datetime from pathlib import Path import markdown BASE = Path(__file__).resolve().parent POSTS_DIR = BASE / "posts" OUT_BLOG = BASE.parent / "website" / "static" / "blog" OUT_HOME = BASE.parent / "website" / "static" / "home.html" OUT_ABOUT = BASE.parent / "website" / "static" / "about.html" SITE_NAME = "Easy Data Collector" SEO_NAME = "江北的渔夫的空间" NAV = [ ("/", "博客"), ("/reslib/", "ResLib"), ("/reslib/apply", "申请 License"), ("/reslib/status", "查询 / 下载"), ("/reslib/package", "资源包获取"), ("/neural/", "Neural Research"), ] def page_header(active: str, title: str = "") -> str: seo_title = f"{title} - {SEO_NAME}" if title else SEO_NAME links = "\n".join( f' {label}' for href, label in NAV ) return f"""
{summary(p['html'])}
""") if not cards: cards.append('暂无文章,敬请期待。
') blog_list = f"""{page_header("/blog/")}工业软件、标准件库与数字化实践记录。
{summary(p['html'], 90)}
""" for p in posts[:3]) if not recent: recent = '暂无文章,敬请期待。
' home = f"""{page_header("/")}工业软件方向开发者。