Fire Emblem Heroes Wiki
Fire Emblem Heroes Wiki
Template-info.svg Documentation

Lua counterpart to Template:Tab. Contains a single function, tabber, which:

  • takes a Lua sequence of 2-tuples containing tab titles and contents (both can be any Lua value convertible to a string via tostring);
  • generates a tabber with the tabs in the given order;
  • returns the mw.html node of the root <div> element. Tabber styles can be added to the returned node.

Example[]

local Tab = require 'Module:Tab'

Tab.tabber {
    {'tab 1', 'tab content 1'},
    {'tab 2', 'tab content 2'},
    {'tab 3', Tab.tabber {
        {'nested tab 1', 'nested tab content 1'},
        {'nested tab 2', 'nested tab content 2'},
    }},
}
local Util = require 'Module:Util'

local tabber = function (all_tabs)
	local div = mw.html.create('div'):addClass('fehwiki-tabber')
	for _, v in ipairs(all_tabs) do
		div:tag('div'):addClass('fehwiki-tab-header'):wikitext(tostring(v[1]))
		content = tostring(v[2])
		if not Util.isNilOrEmpty(content) then
			div:wikitext(content)
		end
	end
	return div
end

return {tabber = tabber}