mirror of
https://github.com/rommapp/docs.git
synced 2026-04-20 01:04:29 +08:00
Lay the foundation for the RomM 5.0 documentation overhaul per the approved plan in /root/.claude/plans/we-dapper-piglet.md. Infrastructure: - pyproject.toml: add mkdocs-redirects, neoteroi-mkdocs, tomli - mkdocs.yml: wire mkdocs-redirects with full old-URL → new-URL map for every page in the existing nav; fix social-plugin .pngg typo - deploy.yml: only move the `latest` mike alias on `5.*` versions - deploy-v5-preview.yml: push v5 branch → mike alias `next` - pr-checks.yml: strict build + redirect-target verification + lychee link-check on changed Markdown - romm-release-bump.yml: nightly auto-PR pinning rommapp/romm to the latest release and regenerating snippets New IA (lowercase-hyphenated, with redirects from old Pascal-case slugs): - getting-started/, install/, administration/, administration/oidc/, using/, platforms/, ecosystem/, developers/, reference/, troubleshooting/, releases/, about/ - Navigation.md rewritten end-to-end - 106 placeholder pages tagged with `wave: 1|2|3` frontmatter Source-of-truth automation under docs/scripts/: - sources.toml pins the upstream rommapp/romm ref - gen_env_vars.py: parses env.template into a sectioned table (currently emits 94 vars from master) - gen_scheduled_tasks.py: emits the 7 scheduled + 3 manual + 1 watcher task table - gen_platforms.py: stub awaiting a 5.0 SHA pin - check_redirects.py: verifies every redirect target exists post-build (CI gate) - scaffold_ia.py: one-shot IA scaffolder (used to generate the placeholder pages) Wired three Wave-1 reference pages to include their generated snippets via pymdownx.snippets so the integration is provable end-to-end: - reference/environment-variables.md - reference/scheduled-tasks.md - platforms/supported-platforms.md (placeholder snippet for now) Verified `mkdocs build --strict` produces zero non-trivial warnings locally (only git-revision-date warnings on uncommitted files, which resolve on commit).
41 lines
1.0 KiB
Python
41 lines
1.0 KiB
Python
"""Shared helpers for source-of-truth generators."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
import urllib.request
|
|
from pathlib import Path
|
|
|
|
if sys.version_info >= (3, 11):
|
|
import tomllib
|
|
else:
|
|
import tomli as tomllib
|
|
|
|
SCRIPTS_DIR = Path(__file__).resolve().parent
|
|
SOURCES_FILE = SCRIPTS_DIR / "sources.toml"
|
|
SNIPPETS_DIR = SCRIPTS_DIR.parent / "resources" / "snippets"
|
|
|
|
|
|
def load_sources() -> dict:
|
|
with SOURCES_FILE.open("rb") as f:
|
|
return tomllib.load(f)
|
|
|
|
|
|
def romm_raw_url(path: str) -> str:
|
|
sources = load_sources()
|
|
repo = sources["romm"]["repo"]
|
|
ref = sources["romm"]["ref"]
|
|
return f"https://raw.githubusercontent.com/{repo}/{ref}/{path.lstrip('/')}"
|
|
|
|
|
|
def fetch_text(url: str) -> str:
|
|
with urllib.request.urlopen(url, timeout=30) as resp:
|
|
return resp.read().decode("utf-8")
|
|
|
|
|
|
def write_snippet(name: str, content: str) -> Path:
|
|
SNIPPETS_DIR.mkdir(parents=True, exist_ok=True)
|
|
out = SNIPPETS_DIR / name
|
|
out.write_text(content, encoding="utf-8")
|
|
return out
|