For a slightly less "clever" answer, I'd go with Skooma (and its translation into javascript); because it fixes a problem I often find with less code than any solution I've seen on the internet so far.
A library to generate HTML pages in Lua using functional tools. This project is
meant to be complementary to MoonXML with a stronger focus on
performance and hackability and less on easy and quick template writing.
Why?
Because HTML sucks and most existing templating systems end up being glorified
string interpolation.
Additionally, templates usually produce text output, which is very uncomfortable
to modify, as that requires either parsing it back into a data structure or
doing string replacement, which can easily break if the generated HTML changes
or is simply dynamic in general.
How?
Skooma is dead simple: every function returns a tree. No side effects.
After you're done applying whatever transformations to the ast, another function
serializes it into HTML, which you can then use however you want.
When should I use this?
When you feel like your project has outgrown a simplistic approach on
templating, for either…
For a slightly less "clever" answer, I'd go with Skooma (and its translation into javascript); because it fixes a problem I often find with less code than any solution I've seen on the internet so far.
DarkWiiPlayer / skooma
The functional way of generating HTML in Lua
Skooma
A library to generate HTML pages in Lua using functional tools. This project is meant to be complementary to MoonXML with a stronger focus on performance and hackability and less on easy and quick template writing.
Why?
Because HTML sucks and most existing templating systems end up being glorified string interpolation.
Additionally, templates usually produce text output, which is very uncomfortable to modify, as that requires either parsing it back into a data structure or doing string replacement, which can easily break if the generated HTML changes or is simply dynamic in general.
How?
Skooma is dead simple: every function returns a tree. No side effects.
After you're done applying whatever transformations to the ast, another function serializes it into HTML, which you can then use however you want.
When should I use this?
When you feel like your project has outgrown a simplistic approach on templating, for either…
You can read and understand the whole codebase in a matter of minutes and looking at the code would probably be quicker than reading a documentation.