refactor: name site addresses in sitegen.config

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 06:03:21 +01:00
1 parent 8db5bf6cf0
commit 4e67868e11
8 files changed
+26 -22

No files matched your search

+9 -2
View File
@@ -19,12 +19,19 @@ yaml = require_yaml()
STARLIGHT_DIR = "website"
STARLIGHT_CONTENT = "src/content/docs"
SITE_NAME = "RetroBIOS"
REPO_URL = "https://github.com/Abdess/retrobios"
REPO_SLUG = "Abdess/retrobios"
REPO_URL = f"https://github.com/{REPO_SLUG}"
RELEASE_URL = f"{REPO_URL}/releases/latest"
# A release asset's address is this, its tag, a slash and the asset name.
RELEASE_DOWNLOAD = f"{REPO_URL}/releases/download/"
# The upload page of a folder is this followed by the folder.
UPLOAD_ROOT = f"{REPO_URL}/upload/main/"
# What LICENSE grants over the published data: its MIT terms name the
# metadata. The BIOS files themselves are under NOTICE, never this.
DATA_LICENSE = "MIT (LICENSE: scripts, tooling, schemas, documentation and metadata)"
SITE_URL = "https://abdess.github.io/retrobios/"
SITE_ORIGIN = "https://abdess.github.io"
BASE = "/retrobios/"
SITE_URL = SITE_ORIGIN + BASE
GENERATED_DIRS = ["platforms", "systems", "emulators", "wiki", "api", "downloads", "files",
releaserecord.GET_DIR]
# Generated directories of files served as they are, not pages.
+2 -1
View File
@@ -36,8 +36,9 @@ from sitegen import markup
from core.artifacts import json_text, write_if_changed
from sitegen.render import escape_tags
from core.paths import REPO_ROOT
from sitegen.config import REPO_URL
REPO = "https://github.com/Abdess/retrobios"
REPO = REPO_URL
EXPLORER_PAGE = "measurements.md"
METHOD_PAGE = "wiki/measurements.md"
HOSTS_MARKER = "<!-- measurements-hosts -->"
+2 -3
View File
@@ -12,11 +12,10 @@ from pathlib import Path
from typing import ClassVar
from core.paths import REPO_ROOT
from sitegen.config import build_commit
from sitegen.config import BASE, SITE_ORIGIN, build_commit
SITE = "https://abdess.github.io"
BASE = "/retrobios/"
SITE = SITE_ORIGIN
# Elements whose content is never words a reader needs.
SKIPPED = frozenset({"script", "style", "svg", "button", "nav", "template", "noscript", "video"})
HEADINGS = {f"h{n}": n for n in range(1, 7)}
+5 -5
View File
@@ -30,6 +30,7 @@ from model.systems import system_index
from packs.coverage import verify_platform
from resolve.cores import resolve_platform_cores
from resolve.review import LARGE_FILE_ISSUE_URL
from sitegen.config import REPO_SLUG, REPO_URL, SITE_URL, UPLOAD_ROOT
from sitegen.install import display_name, has_release_pack, platform_display
@@ -432,15 +433,14 @@ def collection_line(total_files: int, comp: dict) -> str:
)
SITE_URL = "https://abdess.github.io/retrobios/"
# The installer demo (scripts/make_demo.py): the recording and what it shows.
DEMO_DIR = REPO_ROOT / "docs_assets" / "demo"
DEMO_GIF = "docs_assets/demo/install.gif"
REPO_PATH = "../.."
REPO = "Abdess/retrobios"
REPO = REPO_SLUG
# GitHub's "Add file > Upload files" page for bios/: a browser upload by
# someone without write access lands on a fork and opens a pull request.
UPLOAD_URL = f"https://github.com/{REPO}/upload/main/bios"
UPLOAD_URL = f"{UPLOAD_ROOT}bios"
def clone_line(db: dict) -> str:
@@ -556,8 +556,8 @@ def _catalog_matched_line(db: dict) -> list[str]:
BADGES = (
("PyPI version", "https://img.shields.io/pypi/v/retrobios", "https://pypi.org/project/retrobios/"),
("Validation",
"https://github.com/Abdess/retrobios/actions/workflows/validate.yml/badge.svg?branch=main",
"https://github.com/Abdess/retrobios/actions/workflows/validate.yml"),
f"{REPO_URL}/actions/workflows/validate.yml/badge.svg?branch=main",
f"{REPO_URL}/actions/workflows/validate.yml"),
)
+1 -2
View File
@@ -22,9 +22,8 @@ from pathlib import Path, PurePosixPath
from core.paths import REPO_ROOT
from core.anchors import unique_anchor, toc_slug
from sitegen.config import BASE, SITE_URL
BASE = "/retrobios/"
SITE_URL = "https://abdess.github.io/retrobios/"
# Components a page body may use, and where each comes from.
COMPONENTS = {
+4 -5
View File
@@ -11,6 +11,8 @@ from html.parser import HTMLParser
from pathlib import Path
from urllib.parse import unquote, urlsplit
from sitegen.config import BASE, RELEASE_DOWNLOAD, SITE_NAME
@dataclass
@@ -352,7 +354,7 @@ def _jsonld_issues(page: Page, is_404: bool) -> list[str]:
return messages
def description_template(page: Page, site_name: str = "RetroBIOS") -> str:
def description_template(page: Page, site_name: str = SITE_NAME) -> str:
"""A page's description with its own names taken out: its h1 and its
window title. What is left is the text it shares with its template."""
text = page.descriptions[0] if page.descriptions else ""
@@ -405,9 +407,6 @@ def _check_links(pages: dict, site: Path, base_path: str) -> list[str]:
return issues
RELEASE_DOWNLOAD = "https://github.com/Abdess/retrobios/releases/download/"
def _check_get_pages(
pages: dict, site: Path, platforms_dir: Path, record_path: Path,
) -> list[str]:
@@ -451,7 +450,7 @@ def _check_get_pages(
def validate_site(
site: Path, base_path: str = "/retrobios/", platforms_dir: Path | None = None,
site: Path, base_path: str = BASE, platforms_dir: Path | None = None,
record_path: Path | None = None,
) -> list[str]:
site = site.resolve()
+2 -2
View File
@@ -11,7 +11,7 @@ from model import siteinputs
from model.composition import count_catalog_matched
from model.platforms import load_platform_config
from model.profiles import unique_emulator_profiles
from sitegen.config import RELEASE_URL, REPO_URL
from sitegen.config import RELEASE_DOWNLOAD, RELEASE_URL, REPO_URL
from sitegen.install import display_name
@@ -72,7 +72,7 @@ def release_line(platform_name: str, record: dict) -> list[str]:
pack_name = releaserecord.pack_name_for(platform_name, record)
if not tag or not pack_name:
return []
base = f"{REPO_URL}/releases/download/{tag}"
base = f"{RELEASE_DOWNLOAD}{tag}"
built = _release_date(tag)
lines = [
f"Pack {tag}{f', built {built}' if built else ''}. "
+1 -2
View File
@@ -29,13 +29,12 @@ from packs.crossref import first_hash
from core.hashing import cut_md5_owner, parse_hash_list
from resolve.review import LARGE_FILE_ISSUE_URL, Placement, placement
from resolve.validation import deliverable, filter_files_by_mode, installed_with_emulator
from sitegen.config import UPLOAD_ROOT
ALGORITHMS = ("sha1", "sha256", "md5", "crc32")
# GitHub's upload page takes 25 MB per file. A larger file goes in by a
# push or, past 100 MB, through the issue form (CONTRIBUTING.md).
BROWSER_UPLOAD_LIMIT = 25 * 1024 * 1024
# The upload page of a folder is this followed by the folder.
UPLOAD_ROOT = "https://github.com/Abdess/retrobios/upload/main/"
# Under the site's public folder, read by WantedFiles.astro.
DATA_FILE = "data/wanted.json"