Halo Esports Wiki
Advertisement
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

To edit the documentation or categories for this module, click here.


local util_args = require('Module:ArgsUtil')
local util_title = require('Module:TitleUtil')
local util_vars = require('Module:VarsUtil')
local util_text = require('Module:TextUtil')

local TabsAbstract = require('Module:TabsAbstract')

local Tabs = TabsAbstract:extends()
local TabsFromLua = Tabs:extends()
local p = {}

function p.fromArgs(frame)
	local args = util_args.merge()
	return Tabs():run(args)
end

function p.fromTables(names, links, This)
	return TabsFromLua():run(links, names, This)
end

function Tabs:init()
	self.tabClass = 'tabheader-tab'
	self.contentClass = 'tabheader-content'
	self.activeClass = 'tabheader-active'
	self.outerClass = 'tabheader-top'
end

function Tabs:printOneTab(output, tabDisplay)
	local tab = output:tag('div')
		:addClass(self.tabClass)
	tab:tag('div')
		:addClass(self.contentClass)
		:wikitext(tabDisplay)
	return tab
end

function TabsFromLua:run(links, names, This)
	self.title = mw.title.getCurrentTitle().prefixedText
	self.This = This
	self.links = self:getLinksFromTables(links, names)
	self:setThisVar()
	return self:makeOutput()
end

function TabsFromLua:getLinksFromTables(links, names)
	local ret = {}
	for i, link in ipairs(links) do
		ret[#ret+1] = {
			link = link,
			name = names[i]
		}
	end
	return ret
end

return p
Advertisement