diff options
Diffstat (limited to 'src/ffluci/template.lua')
-rw-r--r-- | src/ffluci/template.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/ffluci/template.lua b/src/ffluci/template.lua index 17f36194fd..f7131488ef 100644 --- a/src/ffluci/template.lua +++ b/src/ffluci/template.lua @@ -52,9 +52,9 @@ compiler_enable_bytecode = false -- Define the namespace for template modules viewns = { translate = ffluci.i18n.translate, - config = ffluci.model.uci.get, + config = function(...) return ffluci.model.uci.get(...) or "" end, controller = os.getenv("SCRIPT_NAME"), - media = ffluci.config.mediaurlbase, + media = ffluci.config.main.mediaurlbase, write = io.write, include = function(name) Template(name):render(getfenv(2)) end, } @@ -108,7 +108,7 @@ function compile(template) elseif p == "~" then re = sanitize(v):gsub("~(.-)%.(.-)%.(.+)", r_uci) elseif p == "=" then - re = r_pexec:format(string.sub(v, 2)) + re = r_pexec:format(v:sub(2)) else re = r_exec:format(v) end @@ -120,6 +120,10 @@ function compile(template) template = string.dump(tf) end + c = c or 1 + ffluci.fs.writefile("/tmp/"..tostring(c), template) + c = c+1 + return template end |