FANDOM


------------------------------------------------------
-- Module that implements building tabs with the Tabber extension
--
-- By User:Tjcool007 from Wikia
------------------------------------------------------
local Tabber = {}
Tabber.__index = Tabber
 
-- Create a new Tabber
function Tabber.new()
    buffer = {}
    setmetatable(buffer,Tabber)
 
    buffer._tabs = {}
    return buffer
end
 
-- Add a tab to the Tabber.
-- If the title of the tab is blank, it will use auto numbering
function Tabber:addTab(title,content)
    local t = self._tabs
 
    content = content or ''
    if not title or title == '' then
    	title = #t+1
    end
 
    t[#t+1] = tostring(title) .. '=' .. tostring(content)
    return self -- Method chaining
end
 
-- Stringify the Tabber
function Tabber:_stringify()
    return table.concat(self._tabs,'|-|')
end
 
-- tostring() implementation
function Tabber:__tostring()
    return mw.getCurrentFrame():preprocess('<tabber>'..self:_stringify()..'</tabber>')
end
 
return Tabber

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.