Mon, 22 Nov 2021 10:40:32 +0000
Pin to latest Prosody trunk revision (eventually aiming for 0.12)
local lfs = require "lfs"; local function readfile(filename) local fh = assert(io.open(filename)); local data = fh:read("*a"); fh:close(); return data; end local _M = {}; local template_base_path = (os.getenv("TEMPLATE_PATH") or ".").."/"; function _M.init(config) local templates = {}; local template_path = template_base_path..(config.templates or "html"); for filename in lfs.dir(template_path) do local template_name = filename; if filename:match("%.html$") then template_name = filename:gsub("%.html$", ""); end templates[template_name] = readfile(template_path.."/"..filename); end return templates; end return _M;