Module:Tab

local p = {} 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') b:wikitext('\'\'\ .. mw.text.trim(args[i]) .. '\'\'\) 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 tab :node(title) :node(content) return tostring(tab) end return p