feat(docs): add services category alongside hardware
Mirror the auto-indexed per-host pattern for a new docs/services/
category, seeded with the six things currently deployed on or around
makerfloss.eu: docs, slides, forgejo, gandi-dns, marp, mermaid.
Generator/hook generalisation:
- scripts/gen_overview.py: replace the hardcoded `hostname` check
with a configurable `key_field` (default: hostname). Add a generic
`key-link` column kind (replaces the old `hostname-link`) and a
`url-link` kind that renders the value as a clickable link.
- scripts/overview_config.yml: declare hardware's key_field, then add
a `services` block (key_field=name, its own kind/status enums,
grouped by kind for the index table).
- scripts/mkdocs_hooks.py: route by `page.file.src_uri` so each
hardware/* page gets a "Specs" table and each services/* page gets
a "Service" table; both share the helpers in gen_overview.
Wiring:
- Makefile: docs-index and docs-check now regenerate and drift-check
both indices.
- .forgejo/workflows/docs.yml: same on the CI runner.
- mkdocs.yml: add Services to nav.
- README.md, CLAUDE.md: list services/ in the repo-layout block.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 17:48:15 +02:00
|
|
|
"""MkDocs build hook: render a Specs section on each hardware or service page from its YAML frontmatter."""
|
2026-05-18 15:24:56 +02:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
|
|
import sys
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
|
|
|
from gen_overview import fmt_cpu, fmt_nic, fmt_ram, fmt_storage # noqa: E402
|
|
|
|
|
|
|
|
|
|
|
feat(docs): add services category alongside hardware
Mirror the auto-indexed per-host pattern for a new docs/services/
category, seeded with the six things currently deployed on or around
makerfloss.eu: docs, slides, forgejo, gandi-dns, marp, mermaid.
Generator/hook generalisation:
- scripts/gen_overview.py: replace the hardcoded `hostname` check
with a configurable `key_field` (default: hostname). Add a generic
`key-link` column kind (replaces the old `hostname-link`) and a
`url-link` kind that renders the value as a clickable link.
- scripts/overview_config.yml: declare hardware's key_field, then add
a `services` block (key_field=name, its own kind/status enums,
grouped by kind for the index table).
- scripts/mkdocs_hooks.py: route by `page.file.src_uri` so each
hardware/* page gets a "Specs" table and each services/* page gets
a "Service" table; both share the helpers in gen_overview.
Wiring:
- Makefile: docs-index and docs-check now regenerate and drift-check
both indices.
- .forgejo/workflows/docs.yml: same on the CI runner.
- mkdocs.yml: add Services to nav.
- README.md, CLAUDE.md: list services/ in the repo-layout block.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 17:48:15 +02:00
|
|
|
def _table(rows: list[tuple[str, str]]) -> str:
|
|
|
|
|
lines = ["| Field | Value |", "|---|---|"]
|
|
|
|
|
for label, value in rows:
|
|
|
|
|
if not value:
|
|
|
|
|
continue
|
|
|
|
|
lines.append(f"| {label} | {value} |")
|
|
|
|
|
return "\n".join(lines)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _hardware_page(meta: dict, body: str) -> str:
|
2026-05-18 15:24:56 +02:00
|
|
|
rows = [
|
|
|
|
|
("Model", meta.get("model")),
|
|
|
|
|
("Location", meta.get("location")),
|
|
|
|
|
("CPU", fmt_cpu(meta)),
|
|
|
|
|
("RAM", fmt_ram(meta)),
|
|
|
|
|
("Storage", fmt_storage(meta)),
|
|
|
|
|
("NIC", fmt_nic(meta)),
|
|
|
|
|
("Status", meta.get("status")),
|
|
|
|
|
]
|
feat(docs): add services category alongside hardware
Mirror the auto-indexed per-host pattern for a new docs/services/
category, seeded with the six things currently deployed on or around
makerfloss.eu: docs, slides, forgejo, gandi-dns, marp, mermaid.
Generator/hook generalisation:
- scripts/gen_overview.py: replace the hardcoded `hostname` check
with a configurable `key_field` (default: hostname). Add a generic
`key-link` column kind (replaces the old `hostname-link`) and a
`url-link` kind that renders the value as a clickable link.
- scripts/overview_config.yml: declare hardware's key_field, then add
a `services` block (key_field=name, its own kind/status enums,
grouped by kind for the index table).
- scripts/mkdocs_hooks.py: route by `page.file.src_uri` so each
hardware/* page gets a "Specs" table and each services/* page gets
a "Service" table; both share the helpers in gen_overview.
Wiring:
- Makefile: docs-index and docs-check now regenerate and drift-check
both indices.
- .forgejo/workflows/docs.yml: same on the CI runner.
- mkdocs.yml: add Services to nav.
- README.md, CLAUDE.md: list services/ in the repo-layout block.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 17:48:15 +02:00
|
|
|
return f"# {meta['hostname']}\n\n## Specs\n\n{_table(rows)}\n\n{body}"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _service_page(meta: dict, body: str) -> str:
|
|
|
|
|
url = meta.get("url")
|
|
|
|
|
upstream = meta.get("upstream")
|
|
|
|
|
rows = [
|
|
|
|
|
("Kind", meta.get("kind")),
|
|
|
|
|
("Host", meta.get("host")),
|
|
|
|
|
("URL", f"[{url}]({url})" if url else ""),
|
|
|
|
|
("Tech", meta.get("tech")),
|
|
|
|
|
("Upstream", f"[{upstream}]({upstream})" if upstream else ""),
|
|
|
|
|
("TLS", meta.get("tls")),
|
|
|
|
|
("Status", meta.get("status")),
|
|
|
|
|
]
|
|
|
|
|
return f"# {meta['name']}\n\n## Service\n\n{_table(rows)}\n\n{body}"
|
2026-05-18 15:24:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
def on_page_markdown(markdown, page, config, files): # noqa: ARG001
|
|
|
|
|
meta = page.meta or {}
|
feat(docs): add services category alongside hardware
Mirror the auto-indexed per-host pattern for a new docs/services/
category, seeded with the six things currently deployed on or around
makerfloss.eu: docs, slides, forgejo, gandi-dns, marp, mermaid.
Generator/hook generalisation:
- scripts/gen_overview.py: replace the hardcoded `hostname` check
with a configurable `key_field` (default: hostname). Add a generic
`key-link` column kind (replaces the old `hostname-link`) and a
`url-link` kind that renders the value as a clickable link.
- scripts/overview_config.yml: declare hardware's key_field, then add
a `services` block (key_field=name, its own kind/status enums,
grouped by kind for the index table).
- scripts/mkdocs_hooks.py: route by `page.file.src_uri` so each
hardware/* page gets a "Specs" table and each services/* page gets
a "Service" table; both share the helpers in gen_overview.
Wiring:
- Makefile: docs-index and docs-check now regenerate and drift-check
both indices.
- .forgejo/workflows/docs.yml: same on the CI runner.
- mkdocs.yml: add Services to nav.
- README.md, CLAUDE.md: list services/ in the repo-layout block.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-18 17:48:15 +02:00
|
|
|
src = (page.file.src_uri or page.file.src_path or "").replace("\\", "/")
|
|
|
|
|
if src.startswith("hardware/") and meta.get("hostname"):
|
|
|
|
|
return _hardware_page(meta, markdown)
|
|
|
|
|
if src.startswith("services/") and meta.get("name"):
|
|
|
|
|
return _service_page(meta, markdown)
|
|
|
|
|
return markdown
|