Perfection is achieved, not when there is nothing more to add,
but when there is nothing left to take away.
— Antoine de Saint-Exupéry
lua-CodeGen is a "safe" template engine.
lua-CodeGen enforces a strict Model-View separation. Only 4 primitives are supplied :
- attribute reference,
- template include,
- conditional include,
- and template application (i.e., map operation).
lua-CodeGen allows to split template in small chunk, and encourages the reuse of them by inheritance.
Each chunk of template is like a rule of a grammar for an unparser generator.
lua-CodeGen is not dedicated to HTML, it could generate any kind of textual code.
the Terence Parr's articles :
- Enforcing Strict Model-View Separation in Template Engines
- A Functional Language For Generating Structured Text
Note : lua-CodeGen is not a port of Terence Parr's StringTemplate.
lua-CodeGen is in beta stage.
It's developed for Lua 5.1 & 5.2.
lua-CodeGen source can be downloaded from GitHub.
lua-CodeGen is available via LuaRocks:
luarocks install lua-codegen
or manually, with:
The test suite requires the module lua-TestMore.
This library is licensed under the terms of the MIT/X11 license, like Lua itself.