assert(media, "No valid theme found")
end
- local function ifattr(cond, key, val)
+ local function _ifattr(cond, key, val)
if cond then
- local env = getfenv(1)
+ local env = getfenv(3)
+ local scope = (type(env.self) == "table") and env.self
return string.format(
' %s="%s"', tostring(key),
luci.util.pcdata(tostring( val
or (type(env[key]) ~= "function" and env[key])
+ or (scope and type(scope[key]) ~= "function" and scope[key])
or "" ))
)
else
media = media;
theme = fs.basename(media);
resource = luci.config.main.resourcebase;
- ifattr = ifattr;
- attr = function(...) return ifattr(true, ...) end
+ ifattr = function(...) return _ifattr(...) end;
+ attr = function(...) return _ifattr(true, ...) end;
}, {__index=function(table, key)
if key == "controller" then
return build_url()