lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Asko Kauppi wrote:


I don't need live data and I'm not in charge of the server. That is, I cannot (easily) install new software there. This is exactly the "market slot" which I see empty - generating plain HTML (or static anyways) from a sort-of 'data description'.

Exactly! On most free hosts, you can only run Perl or PHP script (and most of the time, nothing at all...), and I know no Lua interpreter written in these languages...

CityDesk does news articles etc. pretty cleverly here. (inserting teaser texts to main page etc.)

I'll look at Aranha, though - thanks!

-ak


22.4.2004 kello 12:09, Daniel Silverstone kirjoitti:

Are you sure you want to generate statically though? Aranha and the
others offer a far more exciting possibility -- namely that of creating
pages on the fly; allowing you to incorporate live data, databases and
other sources of information.

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...
And of course, like other solutions given elsewhere, it takes a little bit of work to isolate template generators from the pure CGI code.

The Kepler project integrates CGILua, which is able to generate pages from templates using Lua code inside. Tomas kindly gave me a pre-alpha release of this code, and indeed most of the template work is done in a single Lua function (translate, in prep.lua).

BTW, I wonder why they dropped the original idea of CGILua of having Lua values in <> free markers, so they appear in the static previsualization of the template page, whilst Lua expressions were in <> markers, hidden from user? Perhaps because most other template engines do this way, and perhaps because it can be a false good idea, leaving lot of bad display because of conditional expressions and such.

Anyway, I started to do my own template engine, trying to take good ideas from various sources (Kepler, Aranha, HTP...). I am only at the very early stages, and progress is slow, so don't hold your breath until it is done... Actually, if somebody is making a dream template engine using Lua, I will drop immediately my project... Note: ClearSilver was near of that, but I cannot compile it with MSVC, so I dropped the project.

The most I did is to write specifications of what it can do. It is probably too long to be sent here, so I will make a digest.

I would like to do a pure C engine (probably using the lua_load/getS combination), to be able to use any markup marks, defined per file. Unlike the old CGILua, I won't use template keywords for loops or conditionals. It was needed because CGILua sees each Lua code sequence as a separate chuck. I believe I can process the whole HTML template and transform it in a Lua program, putting HTML parts in a io.write[[ ... ]] and keeping Lua parts as is. Of course, I have to handle correctly entities and some pitfalls like meeting ]] in the HTML part or < and > in Lua code.

I will start with a single file processing, but would like to be able to handle whole sites (describing, of course, the site hierarchy in a Lua file), ideally checking change date and dependencies.

That's the part that becomes less portable, unless carefully designed (I only target Windows machines for my own use, but I am not against portable code...). I also would like to be able to get the size of the file (to be downloaded), the image sizes (for JPG, GIF, PNG, yes, I have the Perl & Java code doing that), to manage links (external, relatives, absolutes, ...), etc.

Lots of wanted features, little time to implement them... :-)
If I get anywhere with that, I will let know the list, of course.

--
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--
Philippe Lhoste (Paris -- France)
Professional programmer and amateur artist
http://jove.prohosting.com/~philho/ (outdated)
http://philho.multimania.com (in French, for files to download)
--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--=#=--