16 lines
377 B
Lua
16 lines
377 B
Lua
local utils = require "../utils"
|
|
return function (template, params, pattern)
|
|
local content = string.gsub(template, pattern or "{{([%w_]+)}}", function (s)
|
|
if params[s] == nil then
|
|
utils.expect_nil("No variable "..s)
|
|
end
|
|
if params[s] == true then
|
|
return "true"
|
|
end
|
|
if params[s] == false then
|
|
return "false"
|
|
end
|
|
return params[s]
|
|
end)
|
|
return content
|
|
end
|