Skip to content

meric/tier

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
A lua template library. It has django style extends and block/endblock.
See output.html and main.lua for an example.

Besides the for loop, other controls you can use in templates are:

1. repeat..until
2. if..[elseif]..[else]..end
3. while..end
4. for..end

Their syntax is identical to the lua syntax for the same controls. Controls can be nested within each other.

Quickstart

- Template.load(filename)
Loads a template at filename
e.g. 
require 'tier.template'
local a = tier.Template.load("templates/example2.html")

- template:render(args)
"args" is a table of arguments to be passed to the template. Returns a string.

e.g.
require 'tier.template'
local a = tier.Template.load("templates/example2.html")
print(a:render{planet="Earth", 
               answer=function() return "42" end, 
               name="example2.html",
               replaced="--replaced by a block--"})



About

A lua template library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages