move template files into lua

This commit is contained in:
Michael Chris Lopez
2021-09-04 16:40:29 +08:00
parent 702156951f
commit d41487904c
5 changed files with 81 additions and 77 deletions

View File

@@ -8,10 +8,9 @@ function interp(s, tab)
end))
end
local function write_template(path, spec)
local function write_template(path, template, values)
print("[write template] " .. path)
local template = io.open("_templates/" .. path .. ".txt", "r"):read "*all"
local content = interp(template, spec)
local content = interp(template, values)
local file = io.open(path, "w")
file:write(content)
file:close()