Re: Temple: Compile time, embedded D templates

2014-01-03 Thread Dylan Knutson
On Friday, 3 January 2014 at 17:50:22 UTC, Nicolas Sicard wrote: I wish Variant worked at compile time myself. Did you file a bug/enhancement request? (I couldn't find one in bugzilla). https://d.puremagic.com/issues/show_bug.cgi?id=11864 Doing some more tests, it seems like just about any tem

Re: Temple: Compile time, embedded D templates

2014-01-03 Thread Nicolas Sicard
On Thursday, 2 January 2014 at 08:36:24 UTC, Dylan Knutson wrote: The reason for this is that std.variant.Variant isn't CTFEable, because it uses memcpy in opAssign. I'd consider that a Phobos bug; perhaps there is a way to make std.variant CTFE compatible? That'd allow for a much wider (and mo

Re: Temple: Compile time, embedded D templates

2014-01-03 Thread Jacob Carlborg
On 2014-01-03 09:39, Dylan Knutson wrote: That's a really good idea... [the day passes by] Support implemented in v0.5.0: https://github.com/dymk/temple#filter-policies FilterPolicies allow the developer to insert hooks for when an expression is appended to the buffer. This can be overloaded f

Re: Temple: Compile time, embedded D templates

2014-01-03 Thread Dylan Knutson
On Thursday, 2 January 2014 at 10:59:27 UTC, Jacob Carlborg wrote: Nice. Do you have any concept of safe vs unsafe strings? That's a really good idea... [the day passes by] Support implemented in v0.5.0: https://github.com/dymk/temple#filter-policies FilterPolicies allow the developer to in

Re: Temple: Compile time, embedded D templates

2014-01-02 Thread Dylan Knutson
On Thursday, 2 January 2014 at 10:59:27 UTC, Jacob Carlborg wrote: On 2014-01-02 02:12, Dylan Knutson wrote: It didn't before, because of how the semantics of eRuby syntax works, but now it does! It seemed like an important thing to support... Here's an example mimicking a subset of Rails' `

Re: Temple: Compile time, embedded D templates

2014-01-02 Thread Jacob Carlborg
On 2014-01-02 02:12, Dylan Knutson wrote: It didn't before, because of how the semantics of eRuby syntax works, but now it does! It seemed like an important thing to support... Here's an example mimicking a subset of Rails' `form_for` helper: [Snip] Nice. Do you have any concept of safe vs un

Re: Temple: Compile time, embedded D templates

2014-01-02 Thread Dylan Knutson
On Thursday, 2 January 2014 at 06:59:04 UTC, yazd wrote: How much of this is done at compile-time? Strictly speaking, just the generation of the code that writes the template to the output buffer. E.g, the code above simulating the Rails form helper would be lowered to code approximately equ

Re: Temple: Compile time, embedded D templates

2014-01-01 Thread yazd
On Thursday, 2 January 2014 at 01:12:24 UTC, Dylan Knutson wrote: On Wednesday, 1 January 2014 at 13:04:27 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 fo

Re: Temple: Compile time, embedded D templates

2014-01-01 Thread Dylan Knutson
I've made a post on Reddit, if anyone that found the library nifty would like to upvote: http://www.reddit.com/r/programming/comments/1u71sr/temple_compile_time_embedded_templating_engine/

Re: Temple: Compile time, embedded D templates

2014-01-01 Thread Dylan Knutson
On Wednesday, 1 January 2014 at 13:04:27 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 tem

Re: Temple: Compile time, embedded D templates

2014-01-01 Thread Jacob Carlborg
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 revam

Re: Temple: Compile time, embedded D templates

2014-01-01 Thread Jacob Carlborg
On 2014-01-01 12:53, Jacob Carlborg wrote: I was pretty sure that was possible, but apparently it doesn't compile. Reported as: https://d.puremagic.com/issues/show_bug.cgi?id=11855 -- /Jacob Carlborg

Re: Temple: Compile time, embedded D templates

2014-01-01 Thread Jacob Carlborg
On 2014-01-01 04:24, Dylan Knutson wrote: 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: str

Re: Temple: Compile time, embedded D templates

2014-01-01 Thread Dylan Knutson
Added a goodie: Nestable capture blocks (like pseudo-templates inside your templates) This template: ``` <% auto outer = capture(() { %> Outer, first <% auto inner = capture(() { %> Inner, first

Re: Temple: Compile time, embedded D templates

2013-12-31 Thread Dylan Knutson
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 tem

Re: Temple: Compile time, embedded D templates

2013-12-31 Thread Jacob Carlborg
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 revam