lgen.lua

Mon, 14 Sep 2009 00:16:13 +0300

author
Tuomo Valkonen <tuomov@iki.fi>
date
Mon, 14 Sep 2009 00:16:13 +0300
changeset 4
4cb0d1dbc65b
parent 3
b2df1b3f2c83
child 5
7667b101cb1e
permissions
-rw-r--r--

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)

mercurial