[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] Orbiter - a personal http app server
- From: steve donovan <steve.j.donovan@...>
- Date: Tue, 8 Feb 2011 13:17:43 +0200
On Tue, Feb 8, 2011 at 1:03 PM, Marc Simpson <marc@0branch.com> wrote:
> The templating engine is trivial at present, though I envisage (as with
> Dancer) the ability to drop in a third party implementation.
While we're talking about template engines, there's a little piece of
code by Rici Lake which is astounding for its power/weight ratio:
http://lua-users.org/wiki/SlightlyLessSimpleLuaPreprocessor
I pulled it out in slightly modified form as:
http://snippets.luacode.org/snippets/Lua_Preprocessor_118
(It's not often that such functionality can fit into the conventional
size of a snippet!)
The cool thing is that Lua code and HTML (or anything) can be freely mixed
<ul>
# for i = 1,10 do
<ld>$('Hello '..i)</ld>
# end
</ul>
Only two rules (a) lines starting with # are Lua and (b) otherwise Lua
expressions can occur in $(...)
The code is well worth studying for the 'aha!' moment.
steve d.