handlers.lua

changeset 7
038275cd92ed
parent 4
4cb0d1dbc65b
child 26
77cd7b8fb6a6
--- a/handlers.lua	Sun May 07 20:02:53 2017 +0100
+++ b/handlers.lua	Tue Jan 16 16:39:48 2018 +0000
@@ -1,9 +1,11 @@
 
-module("handlers", package.seeall)
+--@module handlers
 
-require("handlers.render")
-require("handlers.copy")
-require("handlers.ignore")
+local handlers={}
+
+handlers.render=require("handlers.render")
+handlers.copy=require("handlers.copy")
+handlers.ignore=require("handlers.ignore")
 
 local available={
     { pattern = "%.lg$", handler = handlers.render},
@@ -12,7 +14,7 @@
 }
 
 
-function find(f)
+function handlers.find(f)
     for _, h in ipairs(available) do
         if string.match(f, h.pattern) then
             return h.handler
@@ -23,17 +25,18 @@
 
 local cached={}
 
-function choose(f, env)
-    cached[f] = find(f)
+function handlers.choose(f, env)
+    cached[f] = handlers.find(f)
 end
 
 -- load
-function phase1(f, env)
+function handlers.phase1(f, env)
     return cached[f].phase1(f, env)
 end
 
 -- write
-function phase2(f, env)
+function handlers.phase2(f, env)
     return cached[f].phase2(f, env)
 end
 
+return handlers

mercurial