# -*- coding: utf-8 -*- """ 博客构建脚本:blog/posts/*.md -> website/static/blog/(列表 + 文章页)+ website/static/home.html(首页) front matter 格式: --- title: 文章标题 date: 2026-08-13 tags: 工业软件, ResLib --- """ import re 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 Design Collection" SEO_NAME = "人工智能工程技术研究-江北的渔夫" NAV_ITEMS = [ { "key": "research", "href": "/research/", "label": "前沿技术研究", "children": [ ("http://124.220.63.9:25000", "Research Digest"), ("/research/neural/", "Neural Research"), ("/research/reslib/", "ResLib"), ], }, { "key": "tools", "href": "/tools/", "label": "工具开发", "children": [ ("/tools/sequence-diagram/", "Sequence-Diagram"), ("/tools/uni-viewer/", "Uni-Viewer"), ("/tools/serial-terminal/", "Serial Terminal"), ("/tools/enthalpy-diagram/", "Enthalpy Diagram"), ("/tools/edc-lite-erp/", "EDC Lite ERP"), ("/tools/physics-ai-fluent/", "Physics AI Fluent"), ], }, { "key": "license", "href": "/license/", "label": "License", "children": [ ("/license/apply", "申请 License"), ("/license/status", "查询 / 下载"), ("/license/package", "资源包获取"), ], }, { "key": "blog", "href": "/blog/", "label": "博客", "children": [], }, ] def nav_html(active: str = "") -> str: parts = [] for item in NAV_ITEMS: if not item["children"]: cls = "nav-link active" if item["key"] == active else "nav-link" parts.append(f' {item["label"]}') continue parent_cls = "nav-link active" if item["key"] == active else "nav-link" links = "\n".join( f' {label}' for href, label in item["children"] ) parts.append( f""" """ ) return "\n".join(parts) def page_header(active: str = "", title: str = "") -> str: seo_title = f"{title} - {SEO_NAME}" if title else SEO_NAME return f""" {seo_title}
""" def page_footer() -> str: return f"""
""" def parse_post(path: Path) -> dict: text = path.read_text(encoding="utf-8") m = re.match(r"^---\s*\n(.*?)\n---\s*\n?(.*)$", text, re.S) front, body = ("", text) if m: front, body = m.group(1), m.group(2) meta = {} for line in front.splitlines(): if ":" in line: k, _, v = line.partition(":") meta[k.strip()] = v.strip() html = markdown.markdown( body, extensions=["extra", "toc", "sane_lists", "attr_list", "admonition"], ) return { "slug": path.stem, "title": meta.get("title", path.stem), "date": meta.get("date", ""), "tags": [t.strip() for t in meta.get("tags", "").split(",") if t.strip()], "html": html, } def summary(html: str, length: int = 120) -> str: text = re.sub(r"<[^>]+>", "", html) text = re.sub(r"\s+", " ", text).strip() if len(text) > length: text = text[:length] + "…" return text def fmt_date(s: str) -> str: try: return datetime.strptime(s, "%Y-%m-%d").strftime("%Y年%m月%d日") except ValueError: return s PRODUCT_CARDS = """
◷
主力项目 · Flutter / Android

Sequence-Diagram

PLC 流程节拍与相位角设计:条形 / 圆周 / 流程图三视图,泳道加宽与 drawio 导出。

了解详情 →
◉
Web Component

Uni-Viewer

纯前端、不出网的文件预览组件,271 个扩展名、47 条预览链路。

了解详情 →
⇄
Kotlin · Jetpack Compose

Serial Terminal

串口调试助手:USB-OTG / 蓝牙 SPP / TCP / UDP 调试,12 种自动校验位。

了解详情 →
焓
Kotlin · Jetpack Compose

Enthalpy Diagram

湿空气焓湿图:11 项参数任选两个求解全量结果,交互式焓湿图,纯离线零权限。

了解详情 →
▣
Electron · MySQL

EDC Lite ERP

轻量资源计划与制造管理系统:物料编码、进销存、扫码称配全链路。

了解详情 →
◍
Python · GPU LBM

Physics AI Fluent

GPU 格子玻尔兹曼流场仿真:流化床空床流场分钟级求解,AI for Science 数据工厂。

了解详情 →
""" def build(): posts = [parse_post(p) for p in sorted(POSTS_DIR.glob("*.md"), reverse=True)] posts.sort(key=lambda p: p["date"], reverse=True) OUT_BLOG.mkdir(parents=True, exist_ok=True) # ---------- 博客列表页 ---------- cards = [] for p in posts: tags = "".join(f'{t}' for t in p["tags"]) cards.append(f"""
{tags}

{p['title']}

{summary(p['html'])}

""") if not cards: cards.append('

暂无文章,敬请期待。

') blog_list = f"""{page_header("blog")}

BLOG · 博客

工程实践与研究记录

工业软件、标准件库、深度学习与工具开发的过程记录。

{''.join(cards)}
{page_footer()}""" (OUT_BLOG / "index.html").write_text(blog_list, encoding="utf-8") # ---------- 文章详情页 ---------- for p in posts: tags = "".join(f'{t}' for t in p["tags"]) html = f"""{page_header("blog", p['title'])}

{p['title']}

{p['html']}
{page_footer()}""" (OUT_BLOG / p["slug"]).mkdir(parents=True, exist_ok=True) (OUT_BLOG / p["slug"] / "index.html").write_text(html, encoding="utf-8") # ---------- 首页 ---------- recent = "".join(f"""

{p['title']}

{summary(p['html'], 90)}

""" for p in posts[:3]) if not recent: recent = '

暂无文章,敬请期待。

' home = f"""{page_header("")}

人工智能研究与工程实施

Ai时代,所有项目都值得重构

主力项目

时序图设计 · Sequence Diagram Studio

面向 PLC 流程节拍与相位角设计的专业软件:条形节拍、圆周节拍、流程图三视图共享同一份数据,泳道加宽、依赖关系与关键路径清晰可见。

  • 三视图一份数据 · 泳道 1–5 槽位加宽
  • drawio / SVG / PNG 导出,Windows 与 Android 双端
Sequence Diagram Studio 圆周节拍视图

前沿技术研究

以研究为主、工具为辅 —— 正在持续投入的三个方向。

工具开发

每一款工具都来自真实项目,独立研发、私有部署、持续迭代。

{PRODUCT_CARDS}

最新文章

{recent}
{page_footer()}""" OUT_HOME.write_text(home, encoding="utf-8") # ---------- 关于页 ---------- about = f"""{page_header("")}

ABOUT

关于

Easy Design Collection —— 工业软件与数据产品的独立开发实践。

SinCos

工业软件方向开发者,专注流程工业的数字化与智能化实践。

正在做

  • ResLib:资源中心管理器 —— Creo 7.0+ 标准零部件管理库(Pro/TOOLKIT DLL 插件),支持 License 在线申请与审批
  • Neural Research:NeuralMix AI 混合终点判断与算法研究
  • 工具开发:Sequence-Diagram、Uni-Viewer、Serial Terminal、Enthalpy Diagram、Physics AI Fluent、EDC Lite ERP 等自研产品
  • Research Digest:国际顶尖科研热榜与 AI 突破度分析

联系方式

{page_footer()}""" OUT_ABOUT.write_text(about, encoding="utf-8") print(f"构建完成:{len(posts)} 篇文章 -> {OUT_BLOG} / home.html / about.html") if __name__ == "__main__": build()