Module:Lua banner and Module:Lua banner/sandbox: Difference between pages
(Difference between pages)
Jump to navigation
Jump to search
m (1 revision imported) |
m (1 revision imported: forgot this existed...) |
||
Line 14: | Line 14: | ||
local function getConfig() | local function getConfig() | ||
return mw.loadData('Module:Lua banner/config') | return mw.loadData('Module:Lua banner/config/sandbox') | ||
end | end | ||
Line 31: | Line 31: | ||
function p._main(args, cfg) | function p._main(args, cfg) | ||
local modules = mTableTools.compressSparseArray(args) | local modules = mTableTools.compressSparseArray(args) | ||
local box = p.renderBox(modules, cfg | local box = p.renderBox(modules, cfg) | ||
local trackingCategories = p.renderTrackingCategories(args, modules, nil, cfg) | local trackingCategories = p.renderTrackingCategories(args, modules, nil, cfg) | ||
return box .. trackingCategories | return box .. trackingCategories | ||
end | end | ||
function p.renderBox(modules, cfg | function p.renderBox(modules, cfg) | ||
local boxArgs = {} | local boxArgs = {} | ||
if #modules < 1 then | if #modules < 1 then | ||
cfg = cfg or getConfig() | cfg = cfg or getConfig() | ||
if cfg['allow_wishes'] | if cfg['allow_wishes'] then | ||
boxArgs.text = format('wishtext') | boxArgs.text = format('wishtext') | ||
else | else | ||
Line 73: | Line 73: | ||
-- Error category | -- Error category | ||
if #modules < 1 and not | if #modules < 1 and not cfg['allow_wishes'] and cfg['error_category'] then | ||
cats[#cats + 1] = cfg['error_category'] | cats[#cats + 1] = cfg['error_category'] | ||
end | end | ||
Line 87: | Line 87: | ||
category = pagename and cfg['module_categories'][pagename.text] | category = pagename and cfg['module_categories'][pagename.text] | ||
if not category then | if not category then | ||
if | if cfg['allow_wishes'] and #modules < 1 then | ||
category = cfg['wish_category'] | category = cfg['wish_category'] | ||
else | else |