Module:Navbox

local p = {}

local utilsArg = require("Module:UtilsArg")

function p.Main(frame) local args, err = utilsArg.parse(frame:getParent.args, p.Templates.Navbox) local categories = err and err.categoryText or "" if not args.header then return "", categories end local html = mw.html.create("table") :addClass("navbox mw-collapsible mw-collapsed") :tag("tr") :tag("th") :attr("colspan", 2) :tag("div") :addClass("navbox__header mw-collapsible-toggle") :tag("span") :wikitext(args.header) :done :tag("span") :addClass("navbox__header-toggle-button") :tag("span") :addClass("navbox__header-toggle-button-text mw-collapsible-text") :done :done :done :done :done :done for i, row in ipairs(args.rows) do		local tableRow = html:tag("tr") if row.group then tableRow :tag("th") :wikitext(row.group) :addClass("navbox__row-header") :done :tag("td") :wikitext(row.links) :addClass("navbox__row-links") :done end end if args.footer then html:tag("tr") :tag("th") :addClass("navbox__footer") :attr("colspan", 2) :wikitext(args.footer) end local result = tostring(html:done) return result, categories end

p.Templates = { ["Navbox"] = { wip = true, format = "block", purpose = "Creates navbox templates", categories = {"Metatemplates"}, boilerplate = { separateRequiredParams = false, },		paramOrder = {"header", "image", "group", "links", "footer"}, repeatedGroup = { name = "rows", params = {"group", "links"}, counts = {2, 3, 4, 5, 6, 7}, },		params = { header = { required = true, type = "content", desc = "The navbox header.", trim = true, nilIfEmpty = true, },			image = { type = "wiki-file-name", desc = "A file name, with the  prefix.", trim = true, nilIfEmpty = true, },			group = { type = "string", required = true, desc = "A header for the given row in the navbox.", trim = true, nilIfEmpty = true, },			links = { type = "content", required = true, desc = "A comma-separated list of links for the given row.", trim = true, nilIfEmpty = true, },			footer = { type = "content", desc = "The navbox footer. Usually contains links to relevant categories.", trim = true, nilIfEmpty = true, },		},	}, }

return p