17,273
edits
(allow selector to be nil) |
mNo edit summary |
||
Line 119: | Line 119: | ||
local index = #self.tabs + 1 | local index = #self.tabs + 1 | ||
if index == self.defaultTab then | if index == self.defaultTab then | ||
self.defaultSelection = args.selection | self.defaultSelection = args.selection:gsub( "%s", "" ) | ||
args.default = true | args.default = true | ||
end | end | ||
Line 142: | Line 142: | ||
args = args or {} | args = args or {} | ||
return setmetatable( { | return setmetatable( { | ||
selection = getRequiredArg( args, 'selection', 'Tab.new' ), | selection = getRequiredArg( args, 'selection', 'Tab.new' ):gsub( "%s", "" ), | ||
label = args.label or args.selection, | label = args.label or args.selection, | ||
args = args | args = args | ||
Line 151: | Line 151: | ||
local tab = mw.html.create( 'li' ) | local tab = mw.html.create( 'li' ) | ||
:addClass( 'zdw-tab' ) | :addClass( 'zdw-tab' ) | ||
:attr( 'data-tab-selection', self.selection | :attr( 'data-tab-selection', self.selection ) | ||
:wikitext( self.label ) | :wikitext( self.label ) | ||