[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: HTML authoring by Lua?
- From: Daniel Silverstone <dsilvers@...>
- Date: Fri, 23 Apr 2004 12:30:22 +0100
On Fri, 2004-04-23 at 12:10, Philippe Lhoste wrote:
> Aranha is nice, but uses a modified Lua, which change slightly the syntax (for better
> integration of flow of HTML code in Lua and vice versa).
> I don't know why, but I am a bit uncomfortable with that...
I'm interested to know why you dislike what is effectively the nicest
feature of the language from an author's point of view.
What we added (for those of you who don't know) is:
>>
Stuff
<<
Is converted (in the parser) into
dprint [[
Stuff
]]
Where dprint() is a function used for putting (interpolated) strings
onto the divert stack (a stringstack containing the results to go back
to the web client)
All the <@expression@> interpolation is done in dprint() (and can by
bypassed by using vdprint()).
The primary reason for adding the >> << system is so that HTML with
embedded Lua can be compiled into directly executable code by
surrounding it in >> and << before passing it directly to the Lua
compiler.
All this was done for speed and efficiency at runtime.
Also, it's cute to be able to do:
for name,age,gender in databaseresult() do
>>
<tr><td><@name@></td>
<td><@age@></td>
<td><@gender@></td>
</tr>
<<
end
without littering your code with brackets and strange looking function
calls.
Plus in the middle of HTML you can have constructs like:
<table>
<< for i,v in pairs(footable) do >>
<tr> <td><@i@></td> <td><@v@></td> </tr>
<< end >>
</table>
which again is more flowing than might otherwise be available.
For those who are interested in this, see http://aranha.pepperfish.net/
where tarballs of the work-in-progress have been available for some
time.
D.
--
Daniel Silverstone http://www.digital-scurf.org/
Hostmaster, Webmaster, and Chief Code Wibbler: Digital-Scurf Unlimited
GPG Public key available from keyring.debian.org KeyId: 20687895