Files
jiu/web/_data/changelog.js
T
wangjia 471b980179 refactor(web): 营销站重构为 Eleventy SSG,内容迁移至 Markdown
- 引入 Eleventy 静态站点生成器,页面统一使用 Nunjucks 模板
- base.njk 提供公共 nav / footer / CSS,消除三个页面间的重复代码
- 抽取 color.css(设计 token)+ style.css(公共组件 + utility 类)
- index.njk:首页迁移,用 utility class 替换大量页面私有 CSS
- download.njk:下载页重构,版本号/更新日志从 CHANGELOG.md 构建时解析,OS 自动识别
- docs.njk:文档页重构,12 章内容从 web/content/docs.md 构建时渲染,三列布局保留
- docs.css 单独提取,docs 专有样式不污染公共 CSS
- 内容面向非技术用户重写,去除技术术语和内部路径引用

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 12:24:14 +08:00

45 lines
1.3 KiB
JavaScript

const fs = require('fs');
const path = require('path');
module.exports = function() {
const raw = fs.readFileSync(path.join(__dirname, '../../CHANGELOG.md'), 'utf8');
const lines = raw.split('\n');
const versions = [];
let current = null;
let currentSection = null;
for (const line of lines) {
const versionMatch = line.match(/^## \[([^\]]+)\] - (\d{4}-\d{2}-\d{2})/);
if (versionMatch) {
if (current) versions.push(current);
if (versions.length >= 3) break;
current = { version: versionMatch[1], date: versionMatch[2], sections: [], intro: '' };
currentSection = null;
continue;
}
const sectionMatch = line.match(/^### (.+)/);
if (sectionMatch && current) {
currentSection = { type: sectionMatch[1], items: [] };
current.sections.push(currentSection);
continue;
}
const itemMatch = line.match(/^- (.+)/);
if (itemMatch && current) {
if (currentSection) {
currentSection.items.push(itemMatch[1]);
}
continue;
}
// Free-form text before first section (e.g. v1.0.0 intro paragraph)
if (line.trim() && current && !currentSection && !line.startsWith('#')) {
current.intro = current.intro ? current.intro + ' ' + line.trim() : line.trim();
}
}
if (current && versions.length < 3) versions.push(current);
return versions;
};