Mon, 14 Sep 2009 00:16:13 +0300
fixes
module('lgen', package.seeall) -- export src dst hierarchy require('scan') require('handlers') -- globally add missing stuff require('luaext') -- -- Main -- if #arg < 3 then error("Usage: lgen src tmpl dst") end src = arg[1] tmpl = arg[2] dst = arg[3] print('Scan...') hierarchy = scan.scan(src) local env={ paths={ src=src, dst=dst, tmpl=tmpl, }, pages={ }, } -- Pitäisi env konstruoida. polun perusteella. scan.map(hierarchy, function(f) handlers.choose(f, env) end) print('Phase 1...') scan.map(hierarchy, function(f) handlers.phase1(f, env) end) print('Phase 2...') scan.map(hierarchy, function(f) handlers.phase2(f, env) end, function(d) --log.log("Make path "..path.join(dst, d).."\n") lfs.mkdir(path.join(dst, d)) end) --print('Phase 3...') --scan.map(hierarchy, function(f) handlers.phase3(f, env) end)