Module:Team

local p = {}

function p.team ( frame ) local args = frame local text = '' if frame == mw.getCurrentFrame then args = require( 'Module:ProcessArgs' ).merge( true ) else frame = mw.getCurrentFrame end

local teaminput = mw.ustring.lower(args[1] or '') local teamstyle = mw.ustring.lower(args[2] or 'default') local size = args['size'] local exceptionCases = mw.loadData( 'Module:Teamexceptions' ) --Empty if not args[1] or args[1] == '' then return '' --Special Cases elseif exceptionCases[teaminput] then exception = exceptionCases[teaminput] tstyles = mw.loadData( 'Module:Teamexceptionstyles' ) text = tstyles[teamstyle] if not size then text = text:gsub("REPLACESIZE","") else text = text:gsub("REPLACESIZE(%d+)px",size) end text = text:gsub("REPLACE(%u+)", { ["TEXT"] = exception["text"], ["SHORT"] = exception["text"], ["FILE"] = exception["image"], ["TITLE"] = exception["hover"] }) return text -- Normal Teams else local tnames = mw.loadData( 'Module:Teamnames' ) local namevars = tnames[teaminput] local logo = ""

if not namevars then namevars = {link = args[1], long = args[1], medium = args[1], short = args['short'] or args[1] } elseif type(namevars) == 'string' then namevars = tnames[namevars] logo = namevars.link:gsub("+", " ") else logo = namevars.link:gsub("+", " ") end local tstyles = mw.loadData('Module:Teamstyles') text = tstyles[teamstyle] if not size then text = text:gsub("REPLACESIZE","") else text = text:gsub("REPLACESIZE(%d+)px",size) end text = text:gsub("REPLACE(%u+)", { ["LINK"] = namevars.link, ["LONG"] = namevars.long, ["MEDIUM"] = namevars.medium, ["SHORT"] = namevars.short, ["FILE"] = logo }) return text

end end return p