Convert social and federation profile from Jinja to SX rendering

Add primitives (replace, strip-tags, slice, csrf-token), convert all
social blueprint routes and federation profile to SX content builders,
delete 12 unused Jinja templates and social_lite layout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-03 17:43:47 +00:00
parent 0c9dbd6657
commit 0a81a2af01
18 changed files with 760 additions and 503 deletions

View File

@@ -41,6 +41,7 @@ IO_PRIMITIVES: frozenset[str] = frozenset({
"nav-tree",
"get-children",
"g",
"csrf-token",
})
@@ -314,6 +315,17 @@ async def _io_g(
return getattr(g, key, None)
async def _io_csrf_token(
args: list[Any], kwargs: dict[str, Any], ctx: RequestContext
) -> str:
"""``(csrf-token)`` → current CSRF token string."""
from quart import current_app
csrf = current_app.jinja_env.globals.get("csrf_token")
if callable(csrf):
return csrf()
return ""
_IO_HANDLERS: dict[str, Any] = {
"frag": _io_frag,
"query": _io_query,
@@ -326,4 +338,5 @@ _IO_HANDLERS: dict[str, Any] = {
"nav-tree": _io_nav_tree,
"get-children": _io_get_children,
"g": _io_g,
"csrf-token": _io_csrf_token,
}