mirror of
https://github.com/YunoHost/SSOwat.git
synced 2024-09-03 20:06:27 +02:00
29 lines
754 B
Lua
29 lines
754 B
Lua
-- lustache: Lua mustache template parsing.
|
|
-- Copyright 2013 Olivine Labs, LLC <projects@olivinelabs.com>
|
|
-- MIT Licensed.
|
|
|
|
module('lustache', package.seeall)
|
|
|
|
local string_gmatch = string.gmatch
|
|
|
|
function string.split(str, sep)
|
|
local out = {}
|
|
for m in string_gmatch(str, "[^"..sep.."]+") do out[#out+1] = m end
|
|
return out
|
|
end
|
|
|
|
local lustache = {
|
|
name = "lustache",
|
|
version = "1.3.1-0",
|
|
renderer = require("lustache.renderer"):new(),
|
|
}
|
|
|
|
return setmetatable(lustache, {
|
|
__index = function(self, idx)
|
|
if self.renderer[idx] then return self.renderer[idx] end
|
|
end,
|
|
__newindex = function(self, idx, val)
|
|
if idx == "partials" then self.renderer.partials = val end
|
|
if idx == "tags" then self.renderer.tags = val end
|
|
end
|
|
})
|