Module:Legend

local util_args = require('Module:ArgsUtil')

local ORDER = { 'upwith3bye', 'upwith2bye', 'semifinals', 'upwithbye', 'proceed', 'up', 'stayup', 'stay', 'staydown', 'down', 'drop', 'autorelegate', 'clinch-up', 'clinch-down', 'boldtext', 'incomplete', 'specialqualify' }

local p = {} function p.main(frame) local args = util_args.merge(true) local th = mw.html.create p._main(th, args) return th end

function p._main(th, args) local outerdiv = th:tag('div') :css({position = 'relative'}) local div = outerdiv:tag('div') :addClass('table-header-rightcontent') local div2 = div:tag('div') :addClass('match-row') :css({ ['margin-left'] = '5px' }) local tbl = div2:tag('div') :addClass('bracket-game-details legend-table') :css({			['margin-left'] = (((args.legendwidth or 8) - 250) / 2) .. 'px',			width = '250px'		 }) :tag('div') :addClass('header') :tag('div') :addClass('legend-header') :wikitext('Legend') :done :done :tag('table') :addClass('legend-table') local legendOrder = args.legendorder and mw.text.split(args.legendorder,'%s,%s') or ORDER for _, v in ipairs(legendOrder) do		if args[v] then tbl:tag('tr') :tag('td') :addClass('standings-' .. v) :cssText(args[v .. 'css']) :wikitext(args[v]) :done :done end end div2:wikitext('') outerdiv:wikitext(args.display or 'Standings') return outerdiv end

return p