parsav  Artifact [212041720e]

Artifact 212041720ee35cb3fb9f41d90cbbe65c2f312f97b765db5da9d161f244b7a8cd:


-- because lua can't scan directories, we need a
-- file that indexes the templates manually, and
-- copies them into a data structure we can then
-- create templates from when we return to terra
local path = ...
local sources = {
	'docskel';
	'confirm';
	'tweet';
	'profile';
	'compose';

	'login-username';
	'login-challenge';

	'conf';
	'conf-profile';
	'conf-sec';
	'conf-sec-credmg';
}

local ingest = function(filename)
	local hnd = io.open(path..'/'..filename)
	local txt = hnd:read('*a')
	io.close(hnd)
	txt = txt:gsub('([^\\])!%b[]', '%1')
	txt = txt:gsub('([^\\])!!.-\n', '%1')
	txt = txt:gsub('\\(!%b[])', '%1')
	txt = txt:gsub('\\(!!)', '%1')
	return txt
end


local views = {}
for _,n in pairs(sources) do views[n:gsub('-','_')] = ingest(n .. '.tpl') end
return views