On Tuesday, 31 December 2013 at 13:10:53 UTC, Jacob Carlborg wrote:
On 2013-12-31 07:05, Dylan Knutson wrote:
Hello,

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!)

Looks quite nice.

Since you support setting variables in a context using opDispatch, why no support opDispatch to get the variables as well? Something like this:

Hello, <%= var.name %>

And to convert to a specific type:

% if(var.should_bort!bool) {


Ah yeah, I quite like that. I tried to implement the `var.should_bort!bool` syntax, but I can't pass an additional type parameter to opDispatch, other than the string of the method it's dispatching to. Is there a way to do that? Something like this:

struct Params
{
private:
        Variant[string] vars;

public:
        T opDispatch(string op, T)() @property
        {
                return vars[op].get!T;
        }
}

Reply via email to