Module:Tabber
Revision as of 08:57, 13 July 2016 by com>Ckwng
Documentation for this module may be created at Module:Tabber/doc
local BaseData = require('Module:BaseData')
local Tabber = BaseData{
_separator = '\n|-|\n'
}
function Tabber:create(data)
data = data or {}
data._tabs = {}
data.__tostring = self._tostring
return self.__index.create(self, data)
end
function Tabber:add_tab(tab_name, tab_contents)
table.insert(self._tabs, tab_name .. '=' .. tab_contents)
end
function Tabber:_tostring()
return (mw.getCurrentFrame() or require('Module:ConsoleFrame')):preprocess('<tabber>' .. table.concat(self._tabs, self._separator) .. '</tabber>')
end
return Tabber