Mustache template engine

Masahiro Nakagawa repeatedly at gmail.com
Fri Feb 25 04:28:00 PST 2011


On Fri, 25 Feb 2011 03:43:40 +0900, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 2/24/11 11:57 AM, Masahiro Nakagawa wrote:
>> 3 weeks ago, I discussed template engine with Goro Fuji(a.k.a Xslate
>> author).
>> In the process, I noticed D does not have template engine library.
>> So I wrote the D version of Mustache.
>>
>> https://bitbucket.org/repeatedly/mustache4d/src
>>
>> Mustache is a logic-less template.
>>
>> http://mustache.github.com/
>>
>> Implementing this library was nice for a change.
>>
>>
>> P.S.
>>
>> I don't test on Windows and 64bit Linux...
>>
>>
>> Masahiro
>
> String templates, nice! This would help a lot with generating e.g.
> dynamic web pages.

Thanks!

> How does it compare to Terence Parr's StringTemplate engine?

I never used StringTemplate, so I can't compare Mustache with  
StringTemplate correctly.
StringTemplate seems to be standard template that has many features, but
I did not mostly use such features in Ruby.

I think Mustache features enough to use general cases(ctemplate is a good  
example too).
Logic-less approach is safety and makes template file more simple, but it  
is trade-off.
In a subjective answer, I like "{{#list}}" than "$foreach n in names$".

Of course, I think we need StringTemplate-like library for complex cases.


Masahiro


More information about the Digitalmars-d-announce mailing list