Fandom Developers Wiki
Documentation icon Module documentation

The documentation for this module is missing. Click here to create it.

local p = {}

function p.main(frame)
	local args = require('Dev:Arguments').getArgs(frame)
	
	return p._main(args)
end

function p._main(args)
	local tabber = mw.html.create('div'):addClass('tabber wds-tabber dev-tabber')
	local wrapper = tabber:tag('div'):addClass('wds-tabs__wrapper with-bottom-border')
	local labels = wrapper:tag('ul'):addClass('wds-tabs')
	
	local idx = 1
	while true do
		local label = args[2 * idx - 1]
		local content = args[2 * idx]
		if label == nil then break end
		
		local is_current = idx == 1 and 'wds-is-current' or ''
		labels:tag('li'):addClass('wds-tabs__tab ' .. is_current)
			:attr('data-hash', mw.uri.anchorEncode(label))
			:tag('div'):addClass('wds-tabs__tab-label')
			:wikitext('[[##|', label, ']]')
		
		tabber:tag('div'):addClass('wds-tab__content ' .. is_current)
			:wikitext('\n', content, '\n')
		
		idx = idx + 1
	end
	
	return tabber
end

return p