feat(homepage): 新增独立授权与激活页 /license + 补齐定价页样式基础类
CI / Lint & TypeCheck (push) Canceled after 0s
CI / Test (push) Canceled after 0s
CI / Tauri Foundation Acceptance (push) Canceled after 0s
CI / Build (macos-latest) (push) Canceled after 0s
CI / Build (ubuntu-latest) (push) Canceled after 0s
CI / Build (windows-latest) (push) Canceled after 0s
CI / Lint & TypeCheck (push) Canceled after 0s
CI / Test (push) Canceled after 0s
CI / Tauri Foundation Acceptance (push) Canceled after 0s
CI / Build (macos-latest) (push) Canceled after 0s
CI / Build (ubuntu-latest) (push) Canceled after 0s
CI / Build (windows-latest) (push) Canceled after 0s
- 新增 homepage/license.html → dist/license.html + dist/license/index.html: 交付与激活四步(邮件交付授权码)、LIC- 在线 与 LICOFF- 离线 对比、 授权服务器 licence.rlwj.cn 通信范围说明、授权类型与价格、10 条授权 FAQ - 补 style.css 缺失的定价/授权页共享基础类(wrap/section/sec-title/price-card/ plan-tag/deal-note 等,暗色主题版)—— 修复 /pricing 页此前内容贴左、 价格卡无卡片样式的线上缺陷(仅新增规则,未改动既有样式) - tools/homepage-build 支持可选单页,产出 <name>.html 与 <name>/index.html - 导航/页脚接入 /license,子页跨页锚点补 / 前缀、品牌 logo 回首页
This commit is contained in:
1 parent
fcd244637c
commit
e3962a6334
13 files changed
+1242
-30
No files matched your search
@@ -1,6 +1,6 @@
|
||||
// homepage-build:把 homepage/ 源(落地页+文档 md)构建为纯静态站点 homepage/dist/。
|
||||
// 产物可直接部署到任意静态托管(nginx/Pages)——官网与桌面二进制彻底解耦。
|
||||
// 用法: go run ./tools/homepage-build [-src homepage] [-out homepage/dist]
|
||||
// 用法(独立 Go 模块,须在其目录内运行): cd tools/homepage-build && go run . -src ../../homepage -out ../../homepage/dist
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -51,8 +51,8 @@ type Page struct {
|
||||
}
|
||||
|
||||
var (
|
||||
hRe = regexp.MustCompile(`(?s)<(h[23])>(.*?)</h[23]>`)
|
||||
tagRe = regexp.MustCompile(`<[^>]+>`)
|
||||
hRe = regexp.MustCompile(`(?s)<(h[23])>(.*?)</h[23]>`)
|
||||
tagRe = regexp.MustCompile(`<[^>]+>`)
|
||||
mdNoise = regexp.MustCompile("(?s)```.*?```|`[^`]*`|!\\[[^\\]]*\\]\\([^)]*\\)|\\[[^\\]]*\\]\\([^)]*\\)|[#>*_\\-|]+")
|
||||
)
|
||||
|
||||
@@ -97,22 +97,39 @@ func writeFile(path, content string) {
|
||||
fmt.Println("[OK]", path)
|
||||
}
|
||||
|
||||
// copyTree 幂等地把 src 目录整棵拷到 dst:先清空 dst 再 CopyFS。
|
||||
// os.CopyFS 在目标文件已存在时会报错,故重建 dist 前必须先清空对应子目录。
|
||||
func copyTree(dst, src string) {
|
||||
must(os.RemoveAll(dst), "清理 "+dst)
|
||||
must(os.CopyFS(dst, os.DirFS(src)), "拷 "+dst)
|
||||
fmt.Println("[OK]", dst)
|
||||
}
|
||||
|
||||
func main() {
|
||||
src := flag.String("src", "homepage", "源目录")
|
||||
out := flag.String("out", "homepage/dist", "产物目录")
|
||||
flag.Parse()
|
||||
|
||||
// 1) 落地页: 纯 HTML 直接拷 + site assets
|
||||
raw, err := os.ReadFile(filepath.Join(*src, "index.html"))
|
||||
must(err, "读 index.html")
|
||||
writeFile(filepath.Join(*out, "index.html"), string(raw))
|
||||
if raw2, err2 := os.ReadFile(filepath.Join(*src, "terms.html")); err2 == nil {
|
||||
writeFile(filepath.Join(*out, "terms.html"), string(raw2))
|
||||
// 1) 落地页与附加单页: 纯 HTML 直接拷 + site assets
|
||||
// index.html 必需;pricing/terms/license 为可选页,源存在即产出。
|
||||
// 附加页同时产出 <name>.html 与 <name>/index.html:兼容 nginx 的干净
|
||||
// URL(location = /license) 与纯静态服务器(python -m http.server)。
|
||||
for _, page := range []string{"index.html", "pricing.html", "terms.html", "license.html"} {
|
||||
raw, err := os.ReadFile(filepath.Join(*src, page))
|
||||
if err != nil {
|
||||
if page == "index.html" {
|
||||
must(err, "读 index.html")
|
||||
}
|
||||
continue
|
||||
}
|
||||
writeFile(filepath.Join(*out, page), string(raw))
|
||||
if page != "index.html" {
|
||||
writeFile(filepath.Join(*out, strings.TrimSuffix(page, ".html"), "index.html"), string(raw))
|
||||
}
|
||||
}
|
||||
siteAssets := filepath.Join(*src, "assets")
|
||||
if st, _ := os.Stat(siteAssets); st != nil {
|
||||
must(os.CopyFS(filepath.Join(*out, "site", "assets"), os.DirFS(siteAssets)), "拷 site assets")
|
||||
fmt.Println("[OK]", filepath.Join(*out, "site", "assets"))
|
||||
copyTree(filepath.Join(*out, "site", "assets"), siteAssets)
|
||||
}
|
||||
|
||||
// 2) 文档: manifest → goldmark 渲染 → docs.html 模板
|
||||
@@ -135,7 +152,7 @@ func main() {
|
||||
srcb, err := os.ReadFile(filepath.Join(*src, "content", def.File))
|
||||
must(err, "读文档 "+def.File)
|
||||
var buf strings.Builder
|
||||
must(md.Convert(srcb, &buf), "渲染 "+def.File)
|
||||
must(md.Convert(srcb, &buf), "渲染 "+def.File)
|
||||
body, toc := injectHeadingIDs(buf.String())
|
||||
p := &Page{Slug: def.Slug, Title: def.Title, Group: g.Name, Updated: def.Updated, HTML: body, TOC: toc, Prev: prev}
|
||||
pages[def.Slug] = p
|
||||
@@ -165,8 +182,7 @@ func main() {
|
||||
// docs assets(模板引用 /docs/assets/*)
|
||||
da := filepath.Join(*src, "docs-assets")
|
||||
if st, _ := os.Stat(da); st != nil {
|
||||
must(os.CopyFS(filepath.Join(*out, "docs", "assets"), os.DirFS(da)), "拷 docs assets")
|
||||
fmt.Println("[OK]", filepath.Join(*out, "docs", "assets"))
|
||||
copyTree(filepath.Join(*out, "docs", "assets"), da)
|
||||
}
|
||||
fmt.Printf("[DONE] %d 页文档 + 落地页 → %s(纯静态,可部署任意域名)\n", len(order), *out)
|
||||
}
|
||||
Reference in new issue
Block a user