mirror of
https://github.com/vinta/awesome-python.git
synced 2026-11-10 01:34:28 -06:00
fix: link every repo in verdict preview Source column
The Source column printed repo names as plain text, and a row with an empty url rendered its name as a dead link. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ Maintainer review happens through an interactive HTML page: one row per entry wi
|
||||
## Generate the preview
|
||||
|
||||
1. Build the `DATA` array. A group is `[section, subcategory, rows]`; a row is `[entry, url, downloads, kind, verdict, reason]`, plus an optional seventh `source` field.
|
||||
- `source` says where a row came from when that is not obvious, such as the starred repo behind a scan candidate or an incumbent pulled in during the audit. The page shows a Source column only when a row has one.
|
||||
- `source` says where a row came from when that is not obvious, such as the starred repo behind a scan candidate or an incumbent pulled in during the audit. Name each repo as `owner/repo` (`starred: piskvorky/smart_open`), which the page turns into a GitHub link. The page shows a Source column only when a row has one.
|
||||
- `subcategory` may carry a note after ` — ` (rendered muted): use it for proposed splits, re-homes, or anything the maintainer should weigh for the whole group.
|
||||
- `downloads` is PyPI last-month as a comma-formatted string; use `—` when no signal exists (e.g. agent skill packs), `stdlib` for standard-library modules, `fetch failed` when the lookup failed. State the fetch date in the sub-header.
|
||||
- `kind` sets the buttons independently of the seeded `verdict`:
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
td { padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
|
||||
tr.changed td { background: var(--changed); border-bottom-color: var(--changed-line); }
|
||||
td.name { white-space: nowrap; font-weight: 600; }
|
||||
td.name a { color: var(--ink); text-decoration: none; border-bottom: 1px solid #c8c4c0; }
|
||||
td.name a:hover { border-bottom-color: var(--ink); }
|
||||
td.name a, td.source a { color: var(--ink); text-decoration: none; border-bottom: 1px solid #c8c4c0; }
|
||||
td.name a:hover, td.source a:hover { border-bottom-color: var(--ink); }
|
||||
td.source { font-size: .95rem; color: var(--muted); max-width: 14rem; }
|
||||
td.dl { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--muted); text-align: right; }
|
||||
td.mine { white-space: nowrap; }
|
||||
@@ -78,6 +78,11 @@ const CHOICES = { listed: ["keep", "remove", "park"], candidate: ["add", "reject
|
||||
const cap = v => v[0].toUpperCase() + v.slice(1);
|
||||
|
||||
function rowId(section, name) { return section + "::" + name; }
|
||||
// Each owner/repo in a Source cell links to its GitHub repo.
|
||||
function linkRepos(text) {
|
||||
return (text || "").replace(/(^|[\s(,;])([A-Za-z0-9][\w.-]*\/[\w.-]*[\w])(?=$|[\s),;])/g,
|
||||
(_, pre, repo) => `${pre}<a href="https://github.com/${repo}" target="_blank" rel="noopener">${repo}</a>`);
|
||||
}
|
||||
|
||||
function render() {
|
||||
const app = document.getElementById("app");
|
||||
@@ -94,8 +99,8 @@ function render() {
|
||||
const yours = s.verdict || mine;
|
||||
const changed = yours !== mine || (s.feedback || "").trim() !== "";
|
||||
html += `<tr id="${cssId(id)}" class="${changed ? "changed" : ""}">
|
||||
<td class="name"><a href="${url}" target="_blank" rel="noopener">${name}</a></td>
|
||||
${hasSource ? `<td class="source">${source || ""}</td>` : ""}
|
||||
<td class="name">${url ? `<a href="${url}" target="_blank" rel="noopener">${name}</a>` : name}</td>
|
||||
${hasSource ? `<td class="source">${linkRepos(source)}</td>` : ""}
|
||||
<td class="dl">${dl}</td>
|
||||
<td class="mine"><span class="badge ${mine}">${mine.toUpperCase()}</span></td>
|
||||
<td class="reason">${reason}</td>
|
||||
|
||||
Reference in New Issue
Block a user