mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-18 01:13:30 -05:00
feat: link each emulator page to its pinned commit
This commit is contained in:
1 parent
13b7177c88
commit
de30a43441
3 files changed
+55
No files matched your search
@@ -2470,6 +2470,9 @@ def generate_emulator_page(
|
||||
else:
|
||||
lines.append(f"| Upstream | {upstream} |")
|
||||
lines.append(f"| Version | {version} |")
|
||||
revision = revision_markdown(profile)
|
||||
if revision:
|
||||
lines.append(f"| Revision | {revision} |")
|
||||
lines.append(f"| Profiled | {profiled} |")
|
||||
if cores:
|
||||
lines.append(f"| Cores | {', '.join(str(c) for c in cores)} |")
|
||||
@@ -3989,6 +3992,7 @@ from sitewrite import ( # noqa: E402,F401
|
||||
_sweep_generated,
|
||||
)
|
||||
from sitesources import ( # noqa: E402,F401
|
||||
revision_markdown,
|
||||
_repo_pins,
|
||||
_forge_sources,
|
||||
_source_permalink,
|
||||
|
||||
@@ -92,6 +92,32 @@ def _source_permalink(repo: upstream.Repo, pin: str, path: str,
|
||||
url += f"-L{end}"
|
||||
return url
|
||||
|
||||
def _commit_url(repo: upstream.Repo, pin: str) -> str:
|
||||
"""Forge-specific browser URL for one commit."""
|
||||
base = f"https://{repo.host}/{repo.owner}/{repo.name}"
|
||||
if repo.family == "gitlab":
|
||||
return f"{base}/-/commit/{pin}"
|
||||
return f"{base}/commit/{pin}"
|
||||
|
||||
|
||||
def revision_markdown(profile: dict) -> str:
|
||||
"""Each repository the profile reads, linked at the commit it was read at.
|
||||
|
||||
The page linked the repositories unpinned: the revision every citation
|
||||
refers to sat in the YAML alone, for 178 profiles.
|
||||
"""
|
||||
links = [
|
||||
f"[{repo.slug}@{pin[:12]}]({_commit_url(repo, pin)})"
|
||||
for repo, pin in _forge_sources(profile)
|
||||
]
|
||||
branch = profile.get("source_branch")
|
||||
if branch and not isinstance(branch, dict):
|
||||
links.append(f"branch `{branch}`")
|
||||
elif isinstance(branch, dict):
|
||||
links += [f"{mode} branch `{name}`" for mode, name in branch.items()]
|
||||
return ", ".join(links)
|
||||
|
||||
|
||||
def _source_ref_markdown(profile: dict, value) -> str:
|
||||
"""Render source_ref values as pinned links when their forge is known.
|
||||
|
||||
|
||||
Reference in new issue
Block a user