From 20155de96b73729e37ca4d60e1672cf1fdbb99fa Mon Sep 17 00:00:00 2001 From: George Lambert Date: Fri, 11 Sep 2026 23:00:12 -0400 Subject: [PATCH] Make catalog PDF links host-relative and add a hostname rewrite script. New builds write path-relative PDF annotations so the tree can be served from docs.verae-time.net (or any host at the site root) without a rebuild. scripts/rewrite-docs-host.py retargets an already-built site when absolute URLs are preferred. Live service doors stay on their own hostnames. --- scripts/build-docs-site.py | 74 ++++++++++++----- scripts/check-doc-links.py | 56 ++++++++----- scripts/deploy-docs-site.sh | 6 ++ scripts/rewrite-docs-host.py | 150 +++++++++++++++++++++++++++++++++++ 4 files changed, 246 insertions(+), 40 deletions(-) create mode 100755 scripts/rewrite-docs-host.py diff --git a/scripts/build-docs-site.py b/scripts/build-docs-site.py index 69ea586..075e0bc 100755 --- a/scripts/build-docs-site.py +++ b/scripts/build-docs-site.py @@ -7,6 +7,7 @@ defaults to PDF links; index-md.html is the Markdown/HTML index. from __future__ import annotations +import os import shutil import subprocess from concurrent.futures import ThreadPoolExecutor, as_completed @@ -17,6 +18,11 @@ from urllib.parse import unquote ROOT = Path(__file__).resolve().parents[1] SITE = ROOT / "site" CSS = ROOT / "scripts" / "docs-print.css" +# Display label only. Catalog file links are relative so the tree can move hosts. +DOCS_PUBLIC_HOST = os.environ.get("DOCS_PUBLIC_HOST", "zapier.georgelambert.org") +# If set (e.g. https://docs.verae-time.net), PDF annotations become absolute. +# Empty (default) writes path-relative URIs that work on any hostname at site root. +DOCS_PUBLIC_URL = os.environ.get("DOCS_PUBLIC_URL", "").rstrip("/") SECTIONS = [ ( @@ -180,7 +186,7 @@ def render_md(src: Path, html_dest: Path, pdf_dest: Path, title: str) -> str: header.write_text(f"\n", encoding="utf-8") banner.write_text( f'
' - f'