Zum Inhalt springen

Modul:Icon: Unterschied zwischen den Versionen

auto detect calls from sandbox
(per Jonesey, add ability to set alt from stored icon)
(auto detect calls from sandbox)
Zeile 7: Zeile 7:


local p = {}
local p = {}
-- Determine whether we're being called from a sandbox
local sandbox = mw.getCurrentFrame():getTitle():find('sandbox', 1, true) and '/sandbox' or ''


-- Implements [[Template:Icon]]
-- Implements [[Template:Icon]]
-- Returns the icon image corresponding to a string (like 'B')
-- Returns the icon image corresponding to a string (like 'B')
function p._main(args, data)
function p._main(args, data)
local inSandbox = yesNo(args.sandbox)
local data_module = 'Module:Icon/data'..sandbox
local data_module = 'Module:Icon/data'..(inSandbox and '/sandbox' or '')
data = data or mw.loadData(data_module)
data = data or mw.loadData(data_module)
local code = args.class or args[1]
local code = args.class or args[1]
Anonymer Benutzer