Module:Tab

local p = {}

function p.render(args) local data = {}

local groupedArgs = {} for k,v in pairs(args) do		local prefix, num = string.match(k, '(tab)%-(%d+)') if prefix ~= nil then groupedArgs[prefix] = groupedArgs[prefix] or {} groupedArgs[prefix][tonumber(num)] = v		end end

local container = mw.html.create('div') container :css('display', 'flex') :css('flex-wrap', 'wrap') :css('margin-bottom', '0.8em') :css('text-align', 'center') :css('font-weight', 'bold')

for k,v in pairs(groupedArgs) do		for key, value in pairs(v) do			local tab = mw.html.create('div') tab :css('margin', '0 12px') :css('padding', '14px 8px') :css('min-width', '80px') :css('background-clip', 'padding-box') :css('background-color', '#474646') :css('color', '#fff') :wikitext(value)

local tabContainer = container:tag('div') tabContainer :wikitext( .. tostring(tab) .. ) end end

return tostring(container) end

function p.main(frame) local tabs = p.render(frame.args)

return tabs end

return p