Hi all,
I've just published Ginger, a from-scratch Free Pascal implementation of Jinja2's template syntax - the {{ }} / {% if %} / {% for %} / filters / macros / template-inheritance language that Flask and Django developers use every day.
Why this exists: if you're writing an FPC web app (Brook, fpWeb, mORMot, whatever) and want your frontend/designers to write templates in a syntax that's widely documented, has editor support everywhere, and that a Python-background teammate already knows - instead of inventing yet another bespoke templating mini-language - Ginger renders that exact syntax natively, no Python runtime involved.
uses GingerEnvironment, GingerValue;
var
Env: TGingerEnvironment;
Ctx: TGingerDict;
begin
Env := TGingerEnvironment.Create;
Ctx := GingerEmptyDict;
GingerDictSet(Ctx, 'name', GingerStr('World'));
WriteLn(Env.RenderString('Hello, {{ name }}!', Ctx));
end;
What's in: expressions, if/for/set/with, extends/block/include/import, macros (with varargs/kwargs, *args/**kwargs unpacking), tuple-target set/for, {% raw %}, {% filter %}, the full default filter/test library, range/dict/cycler/namespace/lipsum, whitespace control, custom filters/tests (process-wide and per-Environment, matching real env.filters/env.tests scoping), Unicode-aware casing (Turkish/Azeri/Lithuanian/Dutch locale rules included).
How correctness is handled: every piece of behavior is checked against a real installed jinja2==3.1.6, not against memory or the docs — if Ginger's behavior and real Jinja2's output disagree on something not explicitly called out as a deliberate divergence, that's a bug. 650+ automated tests, 0 unfreed memory blocks on every run. Full design history (54 ADRs) is in the repo if you want to see why something works the way it does, including every known gap versus upstream.
Pre-1.0, BSD-3-Clause, no external users yet - which is exactly why I'm posting here first. Issues, feedback, and PRs welcome.
GitHub Repository:
https://github.com/tnt4brain/ginger