meric/tier
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
master
Could not load branches
Nothing to show
Could not load tags
Nothing to show
{{ refName }}
default
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
-
Clone
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more.
- Open with GitHub Desktop
- Download ZIP
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
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--"})