--[[ Compiles all the pages under src/pages/ with etlua. See the etlua documentation for more info (https://github.com/leafo/etlua) ]] local et = require("etlua") local pagenames = { "index", "author_index", "claim", "paste", "edit", "read", "nostory", "cantedit", "noauthor", "login", "author_paste", "author_edit", "search", "error", } local pages = {} for k,v in pairs(pagenames) do local path = string.format("pages/%s.etlua",v) local parser = et.Parser() local f = assert(io.open(path,"r")) local fdata = assert(f:read("*a")) local code = assert(parser:parse(fdata)) local func = assert(parser:load(parser:chunks_to_lua(),path)) f:close() pages[v] = function(...) local buf = assert(parser:run(func,...)) return table.concat(buf) end end return pages