Module:Tabs

local p = {} local italics = mw.loadData('Module:Tab/italics')

function p.tab(frame)

local args = frame:getParent.args local c, _c = 0, 1 for _, v in ipairs(args) do       c = c + 1 end local tab = mw.html.create('div') tab:addClass('tab') for i = 1, c, 2 do       local b = mw.html.create('u') local title = mw.text.trim(args[i]) if italics[title] then title = '\'\'' .. title .. '\'\''       end b:wikitext('\'\'\ .. title .. '\'\'\) local key = mw.html.create('div') key :addClass('tab-title') :addClass('tab-title-' .. _c) :node(b) local val = mw.html.create('div') val :addClass('tab-content') :addClass('tab-content-' .. _c) :wikitext(args[i + 1]) if i == 1 then key:addClass('tab-title-active') else val:css('display', 'none') end tab :node(key) :node(val) _c = _c + 1 end

return tostring(tab) end return p