mirror of
https://github.com/sparckles/Robyn.git
synced 2026-09-07 12:47:38 +08:00
* feat(templating): add render() shortcut for the local templates folder (#1223) Adds a top-level `render(template_name, **context)` helper to robyn.templating that resolves a `templates` directory relative to the calling file (overridable via `templates_dir`) and renders it through a cached JinjaTemplate. This removes the pathlib/JinjaTemplate boilerplate for the common case: from robyn.templating import render @app.get("/frontend") async def get_frontend(request): return render("index.html", framework="Robyn") Includes unit tests (explicit dir, caller-relative resolution, autoescaping) and a docs section on the templating page. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(templating): make render() engine-agnostic, default Jinja (#1223) Add a `template_engine` parameter to render() (default JinjaTemplate) so a custom TemplateInterface can be used, and drop the meaningless `framework="Robyn"` from the docs/example in favour of demonstrating the templating engine. Caches per (engine, directory). Adds a custom-engine test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(templating): document render() in English and Chinese (#1223) Add the render() shortcut section to the Chinese templating page to match English, and fix both pages' boilerplate `description` metadata (they described "conversation endpoints" instead of templating). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(templating): clear frame refs in render(); decouple docs example (CodeRabbit) - Wrap the caller-frame lookup in render() in try/finally and del the frame references to avoid an inspect reference cycle on per-request renders. - Change the docs render() example (en + zh) to use index.html instead of test.html so it no longer implies the page's framework/templating_engine template, without reintroducing a `framework` variable.