Beyblade Wiki
Advertisement

Documentation for this module may be created at Module:Tabs/doc

local p = {}
local italics = mw.loadData('Module:Tabs/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('tabs')
 
    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('tabs-title')
            :addClass('tabs-title-' .. _c)
            :node(b)
        local val = mw.html.create('div')
 
        val
            :addClass('tabs-content')
            :addClass('tabs-content-' .. _c)
            :wikitext(args[i + 1])
 
       if i == 1 then
           key:addClass('tabs-title-active')
       else
           val:css('display', 'none')
       end
 
        tab
            :node(key)
            :node(val)
 
        _c = _c + 1 
 
    end

    return tostring(tab)
 
end
 
return p
Advertisement