Module:UtilsLayout/Navbox

local p = {} local utilsCode = require("Module:UtilsCode")

function p.CreateNavbox(content, title, collapsed) local class = "navbox mw-collapsible" if collapsed == true or collapsed == nil then -- For backwards compability, navboxes are collapsed by default class = "navbox mw-collapsible mw-collapsed" end result = mw.html.create("div") :addClass(class) :node(mw.html.create("div")			:addClass("navbox-title")			:wikitext(title)) :node(mw.html.create("div")			:addClass("navbox-links mw-collapsible-content")			:wikitext(content)) return tostring(result) end

function p.CreateRowNavbox(rows, title, collapsed) local result = mw.html.create("table") :addClass("navbox-table") for key, row in ipairs(rows) do		if not utilsCode.IsEmpty(row["content"]) then result:node(mw.html.create("tr")				:node(mw.html.create("th") :wikitext(row["title"]) :node(mw.html.create("td")					:wikitext(row["content"])))) end end return p.CreateNavbox(tostring(result), title, collapsed) end return p