Module:Navbox Tabs

local p = {}

local Tabs = require("Module:Tabs") local utilsArg = require("Module:UtilsArg")

function p.Main(frame) local args, err = utilsArg.parse(frame:getParent.args, p.Templates["Navbox Tabs"]) local categories = err and err.categoryText or "" local tabs = Tabs.printTabs(args) local html = mw.html.create("div") :addClass("zw-navbox zw-navbox--tabs") :attr("id", args.id) :tag("div") :addClass("zw-navbox__header") :wikitext(args.header) :done :tag("div") :addClass("zw-navbox__tabs") :wikitext(tabs) :done :done local navbox = tostring(html) if mw.title.getCurrentTitle.nsText == "Template" then return navbox, categories else return navbox end end

p.Templates = { ["Navbox Tabs"] = { format = "block", repeatedGroup = { name = "tabs", params = {"tab", "content"}, counts = {4, 8, 16, 32, 64}, },		paramOrder = {"id", "header", "default", "tab", "content"}, params = { id = { type = "string", desc = "A unique ID for the navbox. Sets the id HTML attribute so that the navbox can be linked to. Defaults to the navbox title.", trim = true, nilIfEmpty = true, },			header = { required = true, type = "content", desc = "The title for the navbox.", trim = true, nilIfEmpty = true, },			default = { type = "number", default = 1, desc = "A number. The index of the default tab.", trim = true, nilIfEmpty = true, },			tab = { type = "string", required = true, desc = "The label for the tab button.", trim = true, nilIfEmpty = true, },			content = { type = "string", required = true, desc = "The content to display for the tab.", trim = true, nilIfEmpty = true, },		},	}, }

return p