ARBEIT MACHT FREI

Moduł:Lua banner i Moduł:Lua banner/sandbox: Różnica pomiędzy stronami

(Różnica między stronami)
Przejdź do nawigacji Przejdź do wyszukiwania
Strona 1
Strona 2
m 1 wersja
 
m 1 wersja
 
Linia 14: Linia 14:


local function getConfig()
local function getConfig()
return mw.loadData('Module:Lua banner/config')
return mw.loadData('Module:Lua banner/config/sandbox')
end
end


Linia 31: Linia 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, args)
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, args)
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'] or yesno(args and args.wish) then
if cfg['allow_wishes'] then
boxArgs.text = format('wishtext')
boxArgs.text = format('wishtext')
else
else
Linia 73: Linia 73:
-- Error category
-- Error category
if #modules < 1 and not (cfg['allow_wishes'] or yesno(args.wish)) and cfg['error_category'] then
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
Linia 87: Linia 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 (cfg['allow_wishes'] or yesno(args.wish)) and #modules < 1 then
if cfg['allow_wishes'] and #modules < 1 then
category = cfg['wish_category']
category = cfg['wish_category']
else
else