Changes

m
11 revisions imported
Line 1: Line 1:  
local BaseData = require('Module:BaseData')
 
local BaseData = require('Module:BaseData')
local FrameObject = require('Module:FrameObject')
      
local Tabber = BaseData{
 
local Tabber = BaseData{
_tag = 'tabber',
   
_separator = '\n|-|\n'
 
_separator = '\n|-|\n'
 
}
 
}
Line 10: Line 8:  
data = data or {}
 
data = data or {}
 
data._tabs = {}
 
data._tabs = {}
return self.__index:create(data)
+
data.__tostring = self._tostring
 +
return self.__index.create(self, data)
 
end
 
end
    
function Tabber:add_tab(tab_name, tab_contents)
 
function Tabber:add_tab(tab_name, tab_contents)
 
table.insert(self._tabs, tab_name .. '=' .. tab_contents)
 
table.insert(self._tabs, tab_name .. '=' .. tab_contents)
self._tab_contents[tab_name] = tab_contents
   
end
 
end
   −
function Tabber:__tostring()
+
function Tabber:_tostring()
return FrameObject():extensionTag(self._tag, table.concat(self._tabs, self._separator))
+
return mw.getCurrentFrame():preprocess('<tabber>' .. table.concat(self._tabs, self._separator) .. '</tabber>')
 
end
 
end
    
return Tabber
 
return Tabber
Bots, gkautomate
12,557

edits