Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

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)

Run the command luarocks install http://github.com/TheLinx/LuaHTML/raw/rocks/luahtml-1.1.1-1.rockspec

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 = [[
<p>Lua is super awesome!</p>
]]
-- and now we close the block:
]]<html>
<head>
<title>[[=pageTitle]]</title>
<!-- This is valid syntax, "=" is shorthand for "return " -->
</head>
<body>
<h1>Example!</h1>
[[ for x=1,10 do
	print("<p>This is paragraph #"..x.."! I bet you didn't know that!</p>")
end ]]
[[=announcement]]
</body>
</html>

Example code

-- we assume that 's' is the variable containing the lhtml source
require("luahtml")
output = luahtml.format(s)
-- super simple!!

About

LuaHTML is a template engine that allows the use of Lua code in your HTML websites.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages