#!/usr/bin/env python3
"""Render the public retirement notice and information for existing users."""
from html import escape
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
NOTICE = "Graphley is no longer publicly distributed."
NAV = ''
def write(path, title, main, head="", description=NOTICE, before_footer=""):
title = escape(title)
html = f"""
{title}
{head}
{main}
{before_footer}
"""
out = ROOT / path
out.parent.mkdir(parents=True, exist_ok=True)
out.write_text(html)
def simple(title, message):
return f'
{title}
{message}
'
VISITOR_HEAD = '\n \n '
VISITOR_MOUNT = ''
# Home: the open-source "make your own branch" band sits above the footer.
BRANCH_NOTE = (ROOT / "tools/templates/branch-note.html").read_text().strip() + "\n "
write("index.html", "Graphley", simple("Graphley", NOTICE).replace("
", VISITOR_MOUNT + "
", 1), VISITOR_HEAD, before_footer=BRANCH_NOTE)
write("404.html", "Page not found · Graphley", simple("Page not found", NOTICE))
write("download/index.html", "Graphley availability", simple("Graphley availability", NOTICE))
write("help/index.html", "Help · Graphley", simple("Graphley help", "Graphley help is in the app."))
write("mcp/index.html", "Local agent connections · Graphley", simple("Local agent connections", 'For the privacy implications of existing local connections, see Graphley privacy.'))
for page in ("privacy",):
write(f"{page}/index.html", f"{page.title()} · Graphley", (ROOT / "tools/templates" / f"{page}.html").read_text().strip())