Temple: Compile time, embedded D templates

Dylan Knutson tcdknutson at gmail.com
Wed Jan 1 02:28:57 PST 2014


Added a goodie: Nestable capture blocks (like pseudo-templates 
inside your templates)

This template:
```
		<% auto outer = capture(() { %>
			Outer, first
			<% auto inner = capture(() { %>
				Inner, first
			<% }); %>
			Outer, second

			<%= inner %>
		<% }); %>

		<%= outer %>
```

Evaluates to this:
```
		Outer, first
		Outer, second
			Inner, first
```

a-la Rail's capture helper. It was slightly strange to implement, 
and means tighter coupling between the template function and a 
template context, but I think at this point that's alright, given 
the two are yin and yang anyways.

Right now they don't lazily evaluate; would it be desirable for 
them to do so?


More information about the Digitalmars-d-announce mailing list