Externalize sexp to .sexpr files + render() API
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m20s
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m20s
Replace all 676 inline sexp() string calls across 7 services with render(component_name, **kwargs) calls backed by 46 external .sexpr component definition files (587 defcomps total). - Add render() function to shared/sexp/jinja_bridge.py - Add load_service_components() helper and update load_sexp_dir() for *.sexpr - Update parser keyword regex to support HTMX hx-on::event syntax - Convert remaining inline HTML in route files to render() calls - Add shared/sexp/templates/misc.sexp for cross-service utility components Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -35,7 +35,7 @@ def register():
|
||||
async def _container_nav_handler():
|
||||
from quart import current_app
|
||||
from shared.infrastructure.urls import market_url
|
||||
from shared.sexp.jinja_bridge import sexp as render_sexp
|
||||
from shared.sexp.jinja_bridge import render as render_comp
|
||||
|
||||
container_type = request.args.get("container_type", "page")
|
||||
container_id = int(request.args.get("container_id", 0))
|
||||
@@ -51,9 +51,9 @@ def register():
|
||||
parts = []
|
||||
for m in markets:
|
||||
href = market_url(f"/{post_slug}/{m.slug}/")
|
||||
parts.append(render_sexp(
|
||||
'(~market-link-nav :href href :name name :nav-class nav-class)',
|
||||
href=href, name=m.name, **{"nav-class": nav_class},
|
||||
parts.append(render_comp(
|
||||
"market-link-nav",
|
||||
href=href, name=m.name, nav_class=nav_class,
|
||||
))
|
||||
return "\n".join(parts)
|
||||
|
||||
@@ -65,7 +65,7 @@ def register():
|
||||
from sqlalchemy import select
|
||||
from shared.models.market import Product
|
||||
from shared.infrastructure.urls import market_url
|
||||
from shared.sexp.jinja_bridge import sexp as render_sexp
|
||||
from shared.sexp.jinja_bridge import render as render_comp
|
||||
|
||||
slug = request.args.get("slug", "")
|
||||
keys_raw = request.args.get("keys", "")
|
||||
@@ -86,8 +86,8 @@ def register():
|
||||
detail = f"<s>{product.regular_price}</s> {product.special_price}"
|
||||
elif product.regular_price:
|
||||
detail = str(product.regular_price)
|
||||
parts.append(render_sexp(
|
||||
'(~link-card :title title :image image :subtitle subtitle :detail detail :link link)',
|
||||
parts.append(render_comp(
|
||||
"link-card",
|
||||
title=product.title, image=product.image,
|
||||
subtitle=subtitle, detail=detail,
|
||||
link=market_url(f"/product/{product.slug}/"),
|
||||
@@ -108,8 +108,8 @@ def register():
|
||||
detail = f"<s>{product.regular_price}</s> {product.special_price}"
|
||||
elif product.regular_price:
|
||||
detail = str(product.regular_price)
|
||||
return render_sexp(
|
||||
'(~link-card :title title :image image :subtitle subtitle :detail detail :link link)',
|
||||
return render_comp(
|
||||
"link-card",
|
||||
title=product.title, image=product.image,
|
||||
subtitle=subtitle, detail=detail,
|
||||
link=market_url(f"/product/{product.slug}/"),
|
||||
|
||||
Reference in New Issue
Block a user