diff -r 3975fa5ed630 -r b2df1b3f2c83 lgen.lua --- a/lgen.lua Sat Sep 12 21:27:57 2009 +0300 +++ b/lgen.lua Sun Sep 13 22:22:47 2009 +0300 @@ -4,27 +4,46 @@ require('scan') require('handlers') +-- globally add missing stuff +require('luaext') -- -- Main -- -if #arg < 2 then - error("Usage: lgen src dst") +if #arg < 3 then + error("Usage: lgen src tmpl dst") end src = arg[1] -dst = arg[2] +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) -print('Phase 3...') -scan.map(hierarchy, function(f) handlers.phase3(f, env) end) +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)