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:
@@ -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,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user