fuzzyworld-tools / commit
Add icon classes to VS Code and source links
server/gen.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/gen.py b/server/gen.py index 7c0b75a..b0f5795 100755 --- a/server/gen.py +++ b/server/gen.py @@ -990,9 +990,9 @@ def build_summary(repo, view, desc, files, ctx, commits, empty, commit_set): break blobs.close() # "Open in VS Code" clones into the visitor's own VS Code; "in the browser" opens our static VS Code web build. - vscode = f'<a href="vscode://vscode.git/clone?url={urllib.parse.quote(clone_url, safe="")}">Open in VS Code</a>' + vscode = f'<a href="vscode://vscode.git/clone?url={urllib.parse.quote(clone_url, safe="")}" class="vscode-link">Open in VS Code</a>' if not empty and os.path.exists(os.path.join(APPS, VSCODE_APP, "index.html")): - vscode += f' · <a href="{APPS_URL}/{VSCODE_APP}/?repo={urllib.parse.quote(name)}">Open in VS Code in the browser</a>' + vscode += f' · <a href="{APPS_URL}/{VSCODE_APP}/?repo={urllib.parse.quote(name)}" class="vscode-link">Open in VS Code in the browser</a>' recent = commits_table(name, commits[:5], commit_set) if commits else "" shots = app_shots(name, name) if app else [] shots_html = ('<p class="shots">' + "".join(f'<a href="{app}"><img src="{esc(u)}" alt="{esc(l)}" loading="lazy"></a>' for u, l in shots[:4]) @@ -1181,7 +1181,7 @@ def build_index(): rows.sort(key=lambda r: r[0], reverse=True) items = [] for last, n, d, a in rows: - app = f' · <a href="{esc(a)}">app</a>' if a else "" + app = f' · <a href="{esc(a)}" class="icon-text"><span class="icon icon-app"></span>app</a>' if a else "" desc = f'<p class="desc">{esc(d)}</p>' if d else "" items.append(f'<li><a class="name" href="{url(n)}/">{esc(n)}</a>' f'<span class="meta">updated {esc(last or "never (empty)")}{app}</span>{desc}</li>') @@ -1228,7 +1228,7 @@ def build_apps_index(): for a in apps: repo = os.path.join(GIT_ROOT, a.get("repo", "") + ".git") public = a.get("repo") and os.path.isdir(repo) and is_public(repo) - src = f'{" · " if a["time"] else ""}<a href="{BASE_URL}/{urllib.parse.quote(a["repo"])}/">source</a>' if public else "" + src = f'{" · " if a["time"] else ""}<a href="{BASE_URL}/{urllib.parse.quote(a["repo"])}/" class="icon-text"><span class="icon icon-code"></span>source</a>' if public else "" when = ("updated " + time.strftime("%Y-%m-%d", time.gmtime(a["time"]))) if a["time"] else "" desc = f'<p class="desc">{esc(a["description"])}</p>' if a.get("description") else "" shots = app_shots(a["app"], a["repo"] if public else None) if a.get("app") else []