projects.md: replace Comments column with 版本 (Std / Pro 3.x / Pro 2.x)

Comments 那列对工程"品质"信号弱(评论量主要看话题热度);换成"版本"
列直接告诉读者每个项目源是哪种 EDA 格式 + 编辑器版本号。当前 15
个项目里 10 Std / 3 Pro 3.x / 2 Pro 2.x。

source_format 字段映射:
  easyeda-std        → Std
  easyeda-pro        → Pro 3.x
  easyeda-pro-legacy → Pro 2.x
  其它               → 透传

editor_version(如 6.5.43 / 3.2.91 / 2.1.40)作为子标签放第二行。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-28 22:01:41 +08:00
parent c6279bff08
commit c721e08c93
2 changed files with 40 additions and 24 deletions

View File

@@ -19,6 +19,17 @@ def fmt_mb(b: int) -> str:
return f"{b / 1024 / 1024:.1f}"
SOURCE_FORMAT_LABEL = {
"easyeda-std": "Std",
"easyeda-pro": "Pro 3.x",
"easyeda-pro-legacy": "Pro 2.x",
"kicad": "KiCad",
"altium": "Altium",
"eagle": "Eagle",
"other": "Other",
}
def collect() -> list[dict]:
rows: list[dict] = []
for meta in (REPO / "data" / "raw").rglob("metadata.json"):
@@ -38,6 +49,8 @@ def collect() -> list[dict]:
"files_count": len(files),
"files_bytes": bytes_total,
"local_dir": str(meta.parent.relative_to(REPO)),
"source_format": m.get("source_format"),
"editor_version": m.get("editor_version"),
}
)
# sort by stars desc, tie-break by likes
@@ -71,12 +84,12 @@ def render(rows: list[dict]) -> str:
w("> 按 **Stars 倒序**。Title → 源站UUID → 本仓库对应目录。")
w("")
w(
"| # | Title | Author | License | "
"⭐ Stars | ❤️ Likes | 🍴 Forks | 👁 Views | 💬 Comments | Files | Size (MB) |"
"| # | Title | Author | License | 版本 | "
"⭐ Stars | ❤️ Likes | 🍴 Forks | 👁 Views | Files | Size (MB) |"
)
w(
"|---|-------|--------|---------|"
"--------:|---------:|---------:|---------:|------------:|------:|----------:|"
"|---|-------|--------|---------|------|"
"--------:|---------:|---------:|---------:|------:|----------:|"
)
for i, r in enumerate(rows, 1):
m = r["metrics"]
@@ -89,10 +102,13 @@ def render(rows: list[dict]) -> str:
author_link = f"[{r['author_display']}]({author_url})"
uuid_short = r["uuid"][:8]
dir_link = f"[`{uuid_short}…`](./{r['local_dir']}/)"
version_label = SOURCE_FORMAT_LABEL.get(r["source_format"] or "", "")
if r["editor_version"]:
version_label = f"{version_label}<br><sub>{r['editor_version']}</sub>"
w(
f"| {i} | {title_link}<br>{dir_link} | {author_link} | {r['license']} | "
f"| {i} | {title_link}<br>{dir_link} | {author_link} | {r['license']} | {version_label} | "
f"{m.get('stars', 0):,} | {m.get('likes', 0):,} | {m.get('forks', 0):,} | "
f"{m.get('views', 0):,} | {m.get('comments', 0):,} | "
f"{m.get('views', 0):,} | "
f"{r['files_count']} | {fmt_mb(r['files_bytes'])} |"
)
w("")