All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m14s
Add 9 new shared s-expression components (cart-mini, auth-menu, account-nav-item, calendar-entry-nav, calendar-link-nav, market-link-nav, post-card, base-shell, error-page) and wire them into all fragment route handlers. 404/403 error pages now render entirely via s-expressions as a full-page proof-of-concept, with Jinja fallback on failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
33 lines
881 B
Python
33 lines
881 B
Python
"""
|
|
Full-page s-expression rendering.
|
|
|
|
Provides ``render_page()`` for rendering a complete HTML page from an
|
|
s-expression, bypassing Jinja entirely. Used by error handlers and
|
|
(eventually) by route handlers for fully-migrated pages.
|
|
|
|
Usage::
|
|
|
|
from shared.sexp.page import render_page
|
|
|
|
html = render_page(
|
|
'(~error-page :title "Not Found" :message "NOT FOUND" :image img :asset-url aurl)',
|
|
image="/static/errors/404.gif",
|
|
asset_url="/static",
|
|
)
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from .jinja_bridge import sexp
|
|
|
|
|
|
def render_page(source: str, **kwargs: Any) -> str:
|
|
"""Render a full HTML page from an s-expression string.
|
|
|
|
This is a thin wrapper around ``sexp()`` — it exists to make the
|
|
intent explicit in call sites (rendering a whole page, not a fragment).
|
|
"""
|
|
return sexp(source, **kwargs)
|