LuaHTML
LuaHTML is a template engine that allows the use of Lua code in your HTML websites.
It stays close to the Lua philosophy and is easy to use.
License
The code is public domain, you may use it however you like without any attribution or royalties.
Backports are appreciated, though!
How to install (with LuaRocks)
How to install (Manually)
Put the folder luahtml somewhere in your Lua module path.
On Linux/Mac this is usually something like /usr/local/share/lua/5.1/.
On Windows it’s C:\Program Files\Lua\5.1\.
Example LHTML page
[[ -- this marks the beginning of a Lua code block
pageTitle = "My Awesome Site!"
announcement = [[
Lua is super awesome!
]]
-- and now we close the block:
]]
[[=pageTitle]]Example!
[[ for x=1,10 do
print("
This is paragraph #"..x.."! I bet you didn't know that!
")end ]]
[[=announcement]]
Example code
-- we assume that 's' is the variable containing the lhtml source
require("luahtml")
output = luahtml.format(s)
-- super simple!!