v1.0.0 of templ-d: An Embedded D Template Engine
    Dylan Knutson 
    tcdknutson at gmail.com
       
    Mon May 27 00:36:49 PDT 2013
    
    
  
Hello everyone,
A few of you might have remembered me posting a proof-of-concept 
embedded D template engine a week or two ago. I'd like to 
announce that a few weeks of development later, I've extracted 
the core idea of that into a Dub-compatible library, called 
templ-d.
The syntax that templ-d uses is identical to that of eRuby, so 
any Ruby programmers will feel right at home with this. However, 
delimiters can easily be changed if you so choose.
Templ-d parses templates at compile time, so there is zero 
runtime overhead when rendering templates. An optional object or 
struct can be passed into templ-d functions, to provide outside 
context to the template.
An example of what the syntax looks like:
% foreach(i; 0..2) {
Index: <%= i %>
% }
will return the string:
Index: 0
Index: 1
Index: 2
Details about passing in additional contexts and 
shorthand/longhand notation plus examples are available at:
> https://github.com/dymk/templ-d
The dub package is located at:
> http://registry.vibed.org/packages/templ-d
This is the first public-presentable D project I've done, so 
critique on the code and pull requests are very welcome. On a 
side note, a target I've got for the library is to be an 
alternative template engine for vibe-d, a web framework written 
in D, but I'll cross that bridge in the future.
    
    
More information about the Digitalmars-d-announce
mailing list