Module:League

local util_args = require('Module:ArgsUtil') local util_table = require('Module:TableUtil') local lang = mw.getLanguage('en')

local h = {}

function h.getInfo(str, settings) local vars = util_args.lookupVars(str, mw.loadData('Module:Leaguenames'), true) if not vars then vars = { link = str, long = str, short = str, image = 'Unknown Infobox Image - Tournament.png' }	end settings.vars = util_table.shallowClone(vars) if settings.link then settings.vars.link = settings.link end return vars end

function h.getClass(str) if not str then return '' end return ('|class=%s-logo-std'):format(str) end

local p = {}

function p.league(frame) local args = util_args.merge(true) local str = lang:lc(args[1] or '') local style = lang:lc(args[2] or 'onlyimage') return p[style](str, args) end

function p.main(frame) local args = util_args.merge(true) local str = lang:lc(args[1] or '') local style = lang:lc(args[2] or 'onlyimage') return p[style](str, args) end

function p.newsitem(str, settings) if not settings then settings = {} end h.getInfo(str, settings) return(' %s'):format(		settings.vars.image,		settings.vars.link,		settings.size or 25,		h.getClass(settings.vars.class),		settings.vars.link,		settings.vars.short	) end

function p.onlyimage(str, settings) if not settings then settings = {} end h.getInfo(str, settings) return (''):format(		settings.vars.image,		settings.size or 25,		h.getClass(settings.vars.class)	) end

function p.leaguename(str, settings) if not settings then settings = {} end h.getInfo(str, settings) return settings.vars.long end

function p.leagueshortname(str, settings) if not settings then settings = {} end h.getInfo(str, settings) return settings.vars.short end

function p.onlyimagelinked(str, settings) if not settings then settings = {} end h.getInfo(str, settings) return (''):format(		settings.vars.image,		settings.vars.link,		settings.size or 25,		h.getClass(settings.vars.class)	) end

return p