A few months ago I had posted a project of mine, templ-d. It was
an experiment in writing a template engine for embedding D code
in arbitrary text files, a-la Vibe.d's Diet templates, but
without the requirement of generating HTML.
So, I've revamped templ-d, and written Temple in its place. It
supports all the neat stuff that a template engine should,
including (but not limited to!)
- Nested templates (`render` templates within templates)
- Layouts that can `yield` to partials
- Compile time generation of the template functions, for zero
- Writes to an OutputStream (a type of OutputRange), making it
compatible with Vibe.d
- Easy to work with template contexts, for passing runtime
variables to templates.
The syntax is based off of eRuby, the templating engine for Ruby
on Rails, so it should be very recognizable to the RoR devs here,
and very intuitive to use for those who haven't used eRuby before.
There's a much more in depth rundown, as well as a plethora of
examples, in the README on the project's page, here:
dub package: http://code.dlang.org/packages/temple
Thanks, and please let me know what you think!