Module:Tabber

-- -- 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(' '..self:_stringify..' ') end return Tabber