libs/web: add export() to template namespace, allows templates to export symbols to the calling view namespace, this is useful for includes defining shared procedures or variables
This commit is contained in:
parent
44cd848b28
commit
f7ab1fbc56
1 changed files with 1 additions and 0 deletions
|
@ -237,6 +237,7 @@ function dispatch(request)
|
||||||
write = luci.http.write;
|
write = luci.http.write;
|
||||||
include = function(name) tpl.Template(name):render(getfenv(2)) end;
|
include = function(name) tpl.Template(name):render(getfenv(2)) end;
|
||||||
translate = function(...) return require("luci.i18n").translate(...) end;
|
translate = function(...) return require("luci.i18n").translate(...) end;
|
||||||
|
export = function(k, v) if tpl.context.viewns[k] == nil then tpl.context.viewns[k] = v end end;
|
||||||
striptags = util.striptags;
|
striptags = util.striptags;
|
||||||
pcdata = util.pcdata;
|
pcdata = util.pcdata;
|
||||||
media = media;
|
media = media;
|
||||||
|
|
Loading…
Reference in a new issue