<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="fr">
	<id>https://fr.sarkarverse.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AMessage_box</id>
	<title>Module:Message box - Historique des versions</title>
	<link rel="self" type="application/atom+xml" href="https://fr.sarkarverse.org/index.php?action=history&amp;feed=atom&amp;title=Module%3AMessage_box"/>
	<link rel="alternate" type="text/html" href="https://fr.sarkarverse.org/index.php?title=Module:Message_box&amp;action=history"/>
	<updated>2026-04-04T19:51:56Z</updated>
	<subtitle>Historique des versions pour cette page sur le wiki</subtitle>
	<generator>MediaWiki 1.44.0</generator>
	<entry>
		<id>https://fr.sarkarverse.org/index.php?title=Module:Message_box&amp;diff=21&amp;oldid=prev</id>
		<title>imported&gt;Abhidevananda : Module:Message box</title>
		<link rel="alternate" type="text/html" href="https://fr.sarkarverse.org/index.php?title=Module:Message_box&amp;diff=21&amp;oldid=prev"/>
		<updated>2013-11-26T12:32:46Z</updated>

		<summary type="html">&lt;p&gt;Module:Message box&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Nouvelle page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- This is a meta-module for producing message box templates, including {{mbox}}, {{ambox}}, {{imbox}}, {{tmbox}}, {{ombox}}, {{cmbox}} and {{fmbox}}.&lt;br /&gt;
&lt;br /&gt;
-- Require necessary modules.&lt;br /&gt;
local htmlBuilder = require(&amp;#039;Module:HtmlBuilder&amp;#039;)&lt;br /&gt;
local categoryHandler = require(&amp;#039;Module:Category handler&amp;#039;).main&lt;br /&gt;
local yesno = require(&amp;#039;Module:Yesno&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
-- Load the configuration page.&lt;br /&gt;
local cfgTables = mw.loadData(&amp;#039;Module:Message box/configuration&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
-- Get a language object for formatDate and ucfirst.&lt;br /&gt;
local lang = mw.language.getContentLanguage()&lt;br /&gt;
&lt;br /&gt;
-- Set aliases for often-used functions to reduce table lookups.&lt;br /&gt;
local format = mw.ustring.format&lt;br /&gt;
local tinsert = table.insert&lt;br /&gt;
local tconcat = table.concat&lt;br /&gt;
local trim = mw.text.trim&lt;br /&gt;
&lt;br /&gt;
local box = {}&lt;br /&gt;
&lt;br /&gt;
local function getTitleObject(page, ...)&lt;br /&gt;
	if type(page) == &amp;#039;string&amp;#039; then&lt;br /&gt;
		-- Get the title object, passing the function through pcall &lt;br /&gt;
		-- in case we are over the expensive function count limit.&lt;br /&gt;
		local success, title = pcall(mw.title.new, page, ...)&lt;br /&gt;
		if success then&lt;br /&gt;
			return title&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function union(t1, t2)&lt;br /&gt;
	-- Returns the union of two arrays.&lt;br /&gt;
	local vals = {}&lt;br /&gt;
	for i, v in ipairs(t1) do&lt;br /&gt;
		vals[v] = true&lt;br /&gt;
	end&lt;br /&gt;
	for i, v in ipairs(t2) do&lt;br /&gt;
		vals[v] = true&lt;br /&gt;
	end&lt;br /&gt;
	local ret = {}&lt;br /&gt;
	for k in pairs(vals) do&lt;br /&gt;
		tinsert(ret, k)&lt;br /&gt;
	end&lt;br /&gt;
	table.sort(ret)&lt;br /&gt;
	return ret&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function getArgNums(args, prefix)&lt;br /&gt;
	local nums = {}&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		local num = mw.ustring.match(tostring(k), &amp;#039;^&amp;#039; .. prefix .. &amp;#039;([1-9]%d*)$&amp;#039;)&lt;br /&gt;
		if num then&lt;br /&gt;
			tinsert(nums, tonumber(num))&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	table.sort(nums)&lt;br /&gt;
	return nums&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function box.getNamespaceId(ns)&lt;br /&gt;
	if not ns then return end&lt;br /&gt;
	if type(ns) == &amp;#039;string&amp;#039; then&lt;br /&gt;
		ns = lang:ucfirst(mw.ustring.lower(ns))&lt;br /&gt;
		if ns == &amp;#039;Main&amp;#039; then&lt;br /&gt;
			ns = 0&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local nsTable = mw.site.namespaces[ns]&lt;br /&gt;
	if nsTable then&lt;br /&gt;
		return nsTable.id&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function box.getMboxType(nsid)&lt;br /&gt;
	-- Gets the mbox type from a namespace number.&lt;br /&gt;
	if nsid == 0 then&lt;br /&gt;
		return &amp;#039;ambox&amp;#039; -- main namespace&lt;br /&gt;
	elseif nsid == 6 then&lt;br /&gt;
		return &amp;#039;imbox&amp;#039; -- file namespace&lt;br /&gt;
	elseif nsid == 14 then&lt;br /&gt;
		return &amp;#039;cmbox&amp;#039; -- category namespace&lt;br /&gt;
	else&lt;br /&gt;
		local nsTable = mw.site.namespaces[nsid]&lt;br /&gt;
		if nsTable and nsTable.isTalk then&lt;br /&gt;
			return &amp;#039;tmbox&amp;#039; -- any talk namespace&lt;br /&gt;
		else&lt;br /&gt;
			return &amp;#039;ombox&amp;#039; -- other namespaces or invalid input&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function box:addCat(ns, cat, sort)&lt;br /&gt;
	if type(cat) ~= &amp;#039;string&amp;#039; then return end&lt;br /&gt;
	local nsVals = {&amp;#039;main&amp;#039;, &amp;#039;template&amp;#039;, &amp;#039;all&amp;#039;}&lt;br /&gt;
	local tname&lt;br /&gt;
	for i, val in ipairs(nsVals) do&lt;br /&gt;
		if ns == val then&lt;br /&gt;
			tname = ns .. &amp;#039;Cats&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	if not tname then&lt;br /&gt;
		for i, val in ipairs(nsVals) do&lt;br /&gt;
			nsVals[i] = format(&amp;#039;&amp;quot;%s&amp;quot;&amp;#039;, val)&lt;br /&gt;
		end&lt;br /&gt;
		error(&amp;#039;invalid ns parameter passed to box:addCat; valid values are &amp;#039; .. mw.text.listToText(nsVals, nil, &amp;#039; or &amp;#039;))&lt;br /&gt;
	end&lt;br /&gt;
	self[tname] = self[tname] or {}&lt;br /&gt;
	if type(sort) == &amp;#039;string&amp;#039; then&lt;br /&gt;
		tinsert(self[tname], format(&amp;#039;[[Category:%s|%s]]&amp;#039;, cat, sort))&lt;br /&gt;
	else&lt;br /&gt;
		tinsert(self[tname], format(&amp;#039;[[Category:%s]]&amp;#039;, cat))&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function box:addClass(class)&lt;br /&gt;
	if type(class) ~= &amp;#039;string&amp;#039; then return end&lt;br /&gt;
	self.classes = self.classes or {}&lt;br /&gt;
	tinsert(self.classes, class)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function box:setTitle(args)&lt;br /&gt;
	-- Get the title object and the namespace.&lt;br /&gt;
	self.pageTitle = getTitleObject(args.page ~= &amp;#039;&amp;#039; and args.page)&lt;br /&gt;
	self.title = self.pageTitle or mw.title.getCurrentTitle()&lt;br /&gt;
	self.demospace = args.demospace ~= &amp;#039;&amp;#039; and args.demospace or nil&lt;br /&gt;
	self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function box:getConfig(boxType)&lt;br /&gt;
	-- Get the box config data from the data page.&lt;br /&gt;
	if boxType == &amp;#039;mbox&amp;#039; then&lt;br /&gt;
		boxType = box.getMboxType(self.nsid)&lt;br /&gt;
	end&lt;br /&gt;
	local cfg = cfgTables[boxType]&lt;br /&gt;
	if not cfg then&lt;br /&gt;
		local boxTypes = {}&lt;br /&gt;
		for k, v in pairs(dataTables) do&lt;br /&gt;
			tinsert(boxTypes, format(&amp;#039;&amp;quot;%s&amp;quot;&amp;#039;, k))&lt;br /&gt;
		end&lt;br /&gt;
		tinsert(boxTypes, &amp;#039;&amp;quot;mbox&amp;quot;&amp;#039;)&lt;br /&gt;
		error(format(&amp;#039;invalid message box type &amp;quot;%s&amp;quot;; valid types are %s&amp;#039;, tostring(boxType), mw.text.listToText(boxTypes)), 2)&lt;br /&gt;
	end&lt;br /&gt;
	return cfg&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function box:removeBlankArgs(cfg, args)&lt;br /&gt;
	-- Only allow blank arguments for the parameter names listed in cfg.allowBlankParams.&lt;br /&gt;
	local newArgs = {}&lt;br /&gt;
	for k, v in pairs(args) do&lt;br /&gt;
		if v ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			newArgs[k] = v&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	for i, param in ipairs(cfg.allowBlankParams or {}) do&lt;br /&gt;
		newArgs[param] = args[param]&lt;br /&gt;
	end&lt;br /&gt;
	return newArgs&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function box:setBoxParameters(cfg, args)&lt;br /&gt;
	-- Get type data.&lt;br /&gt;
	self.type = args.type&lt;br /&gt;
	local typeData = cfg.types[self.type]&lt;br /&gt;
	self.invalidTypeError = cfg.showInvalidTypeError and self.type and not typeData and true or false&lt;br /&gt;
	typeData = typeData or cfg.types[cfg.default]&lt;br /&gt;
	self.typeClass = typeData.class&lt;br /&gt;
	self.typeImage = typeData.image&lt;br /&gt;
&lt;br /&gt;
	-- Find if the box has been wrongly substituted.&lt;br /&gt;
	if cfg.substCheck and args.subst == &amp;#039;SUBST&amp;#039; then&lt;br /&gt;
		self.isSubstituted = true&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Find whether we are using a small message box.&lt;br /&gt;
	if cfg.allowSmall and (&lt;br /&gt;
		cfg.smallParam and args.small == cfg.smallParam&lt;br /&gt;
		or not cfg.smallParam and yesno(args.small)&lt;br /&gt;
	)&lt;br /&gt;
	then&lt;br /&gt;
		self.isSmall = true&lt;br /&gt;
	else&lt;br /&gt;
		self.isSmall = false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add attributes, classes and styles.&lt;br /&gt;
	if cfg.allowId then&lt;br /&gt;
		self.id = args.id&lt;br /&gt;
	end&lt;br /&gt;
	self:addClass(cfg.usePlainlinksParam and yesno(args.plainlinks or true) and &amp;#039;plainlinks&amp;#039;)&lt;br /&gt;
	for _, class in ipairs(cfg.classes or {}) do&lt;br /&gt;
		self:addClass(class)&lt;br /&gt;
	end&lt;br /&gt;
	if self.isSmall then&lt;br /&gt;
		self:addClass(cfg.smallClass or &amp;#039;mbox-small&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
	self:addClass(self.typeClass)&lt;br /&gt;
	self:addClass(args.class)&lt;br /&gt;
	self.style = args.style&lt;br /&gt;
&lt;br /&gt;
	-- Set text style.&lt;br /&gt;
	self.textstyle = args.textstyle&lt;br /&gt;
&lt;br /&gt;
	-- Find if we are on the template page or not. This functionality is only used if useCollapsibleTextFields is set,&lt;br /&gt;
	-- or if both cfg.templateCategory and cfg.templateCategoryRequireName are set.&lt;br /&gt;
	self.useCollapsibleTextFields = cfg.useCollapsibleTextFields&lt;br /&gt;
	if self.useCollapsibleTextFields or cfg.templateCategory and cfg.templateCategoryRequireName then&lt;br /&gt;
		self.name = args.name&lt;br /&gt;
		if self.name then&lt;br /&gt;
			local templateName = mw.ustring.match(self.name, &amp;#039;^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$&amp;#039;) or self.name&lt;br /&gt;
			templateName = &amp;#039;Template:&amp;#039; .. templateName&lt;br /&gt;
			self.templateTitle = getTitleObject(templateName)&lt;br /&gt;
		end&lt;br /&gt;
		self.isTemplatePage = self.templateTitle and mw.title.equals(self.title, self.templateTitle) or false&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Process data for collapsible text fields. At the moment these are only used in {{ambox}}.&lt;br /&gt;
	if self.useCollapsibleTextFields then&lt;br /&gt;
		-- Get the self.issue value.&lt;br /&gt;
		if self.isSmall and args.smalltext then&lt;br /&gt;
			self.issue = args.smalltext&lt;br /&gt;
		else&lt;br /&gt;
			local sect&lt;br /&gt;
			if args.sect == &amp;#039;&amp;#039; then&lt;br /&gt;
				sect = &amp;#039;This &amp;#039; .. (cfg.sectionDefault or &amp;#039;page&amp;#039;)&lt;br /&gt;
			elseif type(args.sect) == &amp;#039;string&amp;#039; then&lt;br /&gt;
				sect = &amp;#039;This &amp;#039; .. args.sect&lt;br /&gt;
			end&lt;br /&gt;
			local issue = args.issue&lt;br /&gt;
			issue = type(issue) == &amp;#039;string&amp;#039; and issue ~= &amp;#039;&amp;#039; and issue or nil&lt;br /&gt;
			local text = args.text&lt;br /&gt;
			text = type(text) == &amp;#039;string&amp;#039; and text or nil&lt;br /&gt;
			local issues = {}&lt;br /&gt;
			tinsert(issues, sect)&lt;br /&gt;
			tinsert(issues, issue)&lt;br /&gt;
			tinsert(issues, text)&lt;br /&gt;
			self.issue = tconcat(issues, &amp;#039; &amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- Get the self.talk value.&lt;br /&gt;
		local talk = args.talk&lt;br /&gt;
		if talk == &amp;#039;&amp;#039; -- Show talk links on the template page or template subpages if the talk parameter is blank.&lt;br /&gt;
			and self.templateTitle &lt;br /&gt;
			and (mw.title.equals(self.templateTitle, self.title) or self.title:isSubpageOf(self.templateTitle))&lt;br /&gt;
		then&lt;br /&gt;
			talk = &amp;#039;#&amp;#039;&lt;br /&gt;
		elseif talk == &amp;#039;&amp;#039; then&lt;br /&gt;
			talk = nil&lt;br /&gt;
		end&lt;br /&gt;
		if talk then&lt;br /&gt;
			-- If the talk value is a talk page, make a link to that page. Else assume that it&amp;#039;s a section heading,&lt;br /&gt;
			-- and make a link to the talk page of the current page with that section heading.&lt;br /&gt;
			local talkTitle = getTitleObject(talk)&lt;br /&gt;
			local talkArgIsTalkPage = true&lt;br /&gt;
			if not talkTitle or not talkTitle.isTalkPage then&lt;br /&gt;
				talkArgIsTalkPage = false&lt;br /&gt;
				talkTitle = getTitleObject(self.title.text, mw.site.namespaces[self.title.namespace].talk.id)&lt;br /&gt;
			end&lt;br /&gt;
			if talkTitle and talkTitle.exists then&lt;br /&gt;
				local talkText = &amp;#039;Relevant discussion may be found on&amp;#039;&lt;br /&gt;
				if talkArgIsTalkPage then&lt;br /&gt;
					talkText = format(&amp;#039;%s [[%s|%s]].&amp;#039;, talkText, talk, talkTitle.prefixedText)&lt;br /&gt;
				else&lt;br /&gt;
					talkText = format(&amp;#039;%s the [[%s#%s|talk page]].&amp;#039;, talkText, talkTitle.prefixedText, talk)&lt;br /&gt;
				end&lt;br /&gt;
				self.talk = talkText&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
&lt;br /&gt;
		-- Get other values.&lt;br /&gt;
		self.fix = args.fix ~= &amp;#039;&amp;#039; and args.fix or nil&lt;br /&gt;
		local date&lt;br /&gt;
		if args.date and args.date ~= &amp;#039;&amp;#039; then&lt;br /&gt;
			date = args.date&lt;br /&gt;
		elseif args.date == &amp;#039;&amp;#039; and self.isTemplatePage then&lt;br /&gt;
			date = lang:formatDate(&amp;#039;F Y&amp;#039;)&lt;br /&gt;
		end&lt;br /&gt;
		if date then&lt;br /&gt;
			self.date = format(&amp;quot; &amp;lt;small&amp;gt;&amp;#039;&amp;#039;(%s)&amp;#039;&amp;#039;&amp;lt;/small&amp;gt;&amp;quot;, date)&lt;br /&gt;
		end&lt;br /&gt;
		self.info = args.info&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Set the non-collapsible text field. At the moment this is used by all box types other than ambox,&lt;br /&gt;
	-- and also by ambox when small=yes.&lt;br /&gt;
	if self.isSmall then&lt;br /&gt;
		self.text = args.smalltext or args.text&lt;br /&gt;
	else&lt;br /&gt;
		self.text = args.text&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Set the below row.&lt;br /&gt;
	self.below = cfg.below and args.below&lt;br /&gt;
&lt;br /&gt;
	-- General image settings.&lt;br /&gt;
	self.imageCellDiv = not self.isSmall and cfg.imageCellDiv and true or false&lt;br /&gt;
	self.imageEmptyCell = cfg.imageEmptyCell&lt;br /&gt;
	if cfg.imageEmptyCellStyle then&lt;br /&gt;
		self.imageEmptyCellStyle = &amp;#039;border:none;padding:0px;width:1px&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Left image settings.&lt;br /&gt;
	local imageLeft = self.isSmall and args.smallimage or args.image&lt;br /&gt;
	if cfg.imageCheckBlank and imageLeft ~= &amp;#039;blank&amp;#039; and imageLeft ~= &amp;#039;none&amp;#039;&lt;br /&gt;
		or not cfg.imageCheckBlank and imageLeft ~= &amp;#039;none&amp;#039;&lt;br /&gt;
	then&lt;br /&gt;
		self.imageLeft = imageLeft&lt;br /&gt;
		if not imageLeft then&lt;br /&gt;
			local imageSize = self.isSmall and (cfg.imageSmallSize or &amp;#039;30x30px&amp;#039;) or &amp;#039;40x40px&amp;#039;&lt;br /&gt;
			self.imageLeft = format(&amp;#039;[[File:%s|%s|link=|alt=]]&amp;#039;, self.typeImage or &amp;#039;Imbox notice.png&amp;#039;, imageSize)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Right image settings.&lt;br /&gt;
	local imageRight = self.isSmall and args.smallimageright or args.imageright&lt;br /&gt;
	if not (cfg.imageRightNone and imageRight == &amp;#039;none&amp;#039;) then&lt;br /&gt;
		self.imageRight = imageRight&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add mainspace categories. At the moment these are only used in {{ambox}}.&lt;br /&gt;
	if cfg.allowMainspaceCategories then&lt;br /&gt;
		if args.cat then&lt;br /&gt;
			args.cat1 = args.cat&lt;br /&gt;
		end&lt;br /&gt;
		self.catNums = getArgNums(args, &amp;#039;cat&amp;#039;)&lt;br /&gt;
		if args.category then&lt;br /&gt;
			args.category1 = args.category&lt;br /&gt;
		end&lt;br /&gt;
		self.categoryNums = getArgNums(args, &amp;#039;category&amp;#039;)&lt;br /&gt;
		if args.all then&lt;br /&gt;
			args.all1 = args.all&lt;br /&gt;
		end&lt;br /&gt;
		self.allNums = getArgNums(args, &amp;#039;all&amp;#039;)&lt;br /&gt;
		self.categoryParamNums = union(self.catNums, self.categoryNums)&lt;br /&gt;
		self.categoryParamNums = union(self.categoryParamNums, self.allNums)&lt;br /&gt;
		-- The following is roughly equivalent to the old {{Ambox/category}}.&lt;br /&gt;
		local date = args.date&lt;br /&gt;
		date = type(date) == &amp;#039;string&amp;#039; and date&lt;br /&gt;
		local preposition = &amp;#039;from&amp;#039;&lt;br /&gt;
		for _, num in ipairs(self.categoryParamNums) do&lt;br /&gt;
			local mainCat = args[&amp;#039;cat&amp;#039; .. tostring(num)] or args[&amp;#039;category&amp;#039; .. tostring(num)]&lt;br /&gt;
			local allCat = args[&amp;#039;all&amp;#039; .. tostring(num)]&lt;br /&gt;
			mainCat = type(mainCat) == &amp;#039;string&amp;#039; and mainCat&lt;br /&gt;
			allCat = type(allCat) == &amp;#039;string&amp;#039; and allCat&lt;br /&gt;
			if mainCat and date and date ~= &amp;#039;&amp;#039; then&lt;br /&gt;
				local catTitle = format(&amp;#039;%s %s %s&amp;#039;, mainCat, preposition, date)&lt;br /&gt;
				self:addCat(&amp;#039;main&amp;#039;, catTitle)&lt;br /&gt;
				catTitle = getTitleObject(&amp;#039;Category:&amp;#039; .. catTitle)&lt;br /&gt;
				if not catTitle or not catTitle.exists then&lt;br /&gt;
					self:addCat(&amp;#039;main&amp;#039;, &amp;#039;Articles with invalid date parameter in template&amp;#039;)&lt;br /&gt;
				end&lt;br /&gt;
			elseif mainCat and (not date or date == &amp;#039;&amp;#039;) then&lt;br /&gt;
				self:addCat(&amp;#039;main&amp;#039;, mainCat)&lt;br /&gt;
			end&lt;br /&gt;
			if allCat then&lt;br /&gt;
				self:addCat(&amp;#039;main&amp;#039;, allCat)&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add template-namespace categories.&lt;br /&gt;
	if cfg.templateCategory then&lt;br /&gt;
		if cfg.templateCategoryRequireName then&lt;br /&gt;
			if self.isTemplatePage then&lt;br /&gt;
				self:addCat(&amp;#039;template&amp;#039;, cfg.templateCategory)&lt;br /&gt;
			end&lt;br /&gt;
		elseif not self.title.isSubpage then&lt;br /&gt;
			self:addCat(&amp;#039;template&amp;#039;, cfg.templateCategory)&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add template error category.&lt;br /&gt;
	if cfg.templateErrorCategory then&lt;br /&gt;
		local templateErrorCategory = cfg.templateErrorCategory&lt;br /&gt;
		local templateCat, templateSort&lt;br /&gt;
		if not self.name and not self.title.isSubpage then&lt;br /&gt;
			templateCat = templateErrorCategory&lt;br /&gt;
		elseif self.isTemplatePage then&lt;br /&gt;
			local paramsToCheck = cfg.templateErrorParamsToCheck or {}&lt;br /&gt;
			local count = 0&lt;br /&gt;
			for i, param in ipairs(paramsToCheck) do&lt;br /&gt;
				if not args[param] then&lt;br /&gt;
					count = count + 1&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if count &amp;gt; 0 then&lt;br /&gt;
				templateCat = templateErrorCategory&lt;br /&gt;
				templateSort = tostring(count)&lt;br /&gt;
			end&lt;br /&gt;
			if self.categoryNums and #self.categoryNums &amp;gt; 0 then&lt;br /&gt;
				templateCat = templateErrorCategory&lt;br /&gt;
				templateSort = &amp;#039;C&amp;#039;&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
		self:addCat(&amp;#039;template&amp;#039;, templateCat, templateSort)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Categories for all namespaces.&lt;br /&gt;
	if self.invalidTypeError then&lt;br /&gt;
		local allSort = (self.nsid == 0 and &amp;#039;Main:&amp;#039; or &amp;#039;&amp;#039;) .. self.title.prefixedText&lt;br /&gt;
		self:addCat(&amp;#039;all&amp;#039;, &amp;#039;Wikipedia message box parameter needs fixing&amp;#039;, allSort)&lt;br /&gt;
	end&lt;br /&gt;
	if self.isSubstituted then&lt;br /&gt;
		self:addCat(&amp;#039;all&amp;#039;, &amp;#039;Pages with incorrectly substituted templates&amp;#039;)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Convert category tables to strings and pass them through [[Module:Category handler]].&lt;br /&gt;
	self.categories = categoryHandler{&lt;br /&gt;
		main = tconcat(self.mainCats or {}),&lt;br /&gt;
		template = tconcat(self.templateCats or {}),&lt;br /&gt;
		all = tconcat(self.allCats or {}),&lt;br /&gt;
		nocat = args.nocat,&lt;br /&gt;
		demospace = self.demospace,&lt;br /&gt;
		page = self.pageTitle and self.pageTitle.prefixedText or nil&lt;br /&gt;
	}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function box:export()&lt;br /&gt;
	local root = htmlBuilder.create()&lt;br /&gt;
&lt;br /&gt;
	-- Add the subst check error.&lt;br /&gt;
	if self.isSubstituted and self.name then&lt;br /&gt;
		root&lt;br /&gt;
			.tag(&amp;#039;b&amp;#039;)&lt;br /&gt;
				.addClass(&amp;#039;error&amp;#039;)&lt;br /&gt;
				.wikitext(format(&lt;br /&gt;
					&amp;#039;Template &amp;lt;code&amp;gt;%s[[Template:%s|%s]]%s&amp;lt;/code&amp;gt; has been incorrectly substituted.&amp;#039;,&lt;br /&gt;
					mw.text.nowiki(&amp;#039;{{&amp;#039;), self.name, self.name, mw.text.nowiki(&amp;#039;}}&amp;#039;)&lt;br /&gt;
				))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Create the box table.&lt;br /&gt;
	local boxTable = root.tag(&amp;#039;table&amp;#039;)&lt;br /&gt;
	boxTable&lt;br /&gt;
		.attr(&amp;#039;id&amp;#039;, self.id)&lt;br /&gt;
	for i, class in ipairs(self.classes or {}) do&lt;br /&gt;
		boxTable&lt;br /&gt;
			.addClass(class)&lt;br /&gt;
	end&lt;br /&gt;
	boxTable&lt;br /&gt;
		.cssText(self.style)&lt;br /&gt;
		.attr(&amp;#039;role&amp;#039;, &amp;#039;presentation&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
	-- Add the left-hand image.&lt;br /&gt;
	local row = boxTable.tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
	if self.imageLeft then&lt;br /&gt;
		local imageLeftCell = row.tag(&amp;#039;td&amp;#039;).addClass(&amp;#039;mbox-image&amp;#039;)&lt;br /&gt;
		if self.imageCellDiv then&lt;br /&gt;
			-- If we are using a div, redefine imageLeftCell so that the image is inside it.&lt;br /&gt;
			-- Divs use style=&amp;quot;width: 52px;&amp;quot;, which limits the image width to 52px. If any&lt;br /&gt;
			-- images in a div are wider than that, they may overlap with the text or cause&lt;br /&gt;
			-- other display problems.&lt;br /&gt;
			imageLeftCell = imageLeftCell.tag(&amp;#039;div&amp;#039;).css(&amp;#039;width&amp;#039;, &amp;#039;52px&amp;#039;) &lt;br /&gt;
		end&lt;br /&gt;
		imageLeftCell&lt;br /&gt;
			.wikitext(self.imageLeft)&lt;br /&gt;
	elseif self.imageEmptyCell then&lt;br /&gt;
		-- Some message boxes define an empty cell if no image is specified, and some don&amp;#039;t.&lt;br /&gt;
		-- The old template code in templates where empty cells are specified gives the following hint:&lt;br /&gt;
		-- &amp;quot;No image. Cell with some width or padding necessary for text cell to have 100% width.&amp;quot;&lt;br /&gt;
		row.tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
			.addClass(&amp;#039;mbox-empty-cell&amp;#039;) &lt;br /&gt;
			.cssText(self.imageEmptyCellStyle)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add the text.&lt;br /&gt;
	local textCell = row.tag(&amp;#039;td&amp;#039;).addClass(&amp;#039;mbox-text&amp;#039;)&lt;br /&gt;
	if self.useCollapsibleTextFields then&lt;br /&gt;
		-- The message box uses advanced text parameters that allow things to be collapsible. At the&lt;br /&gt;
		-- moment, only ambox uses this.&lt;br /&gt;
		textCell&lt;br /&gt;
			.cssText(self.textstyle)&lt;br /&gt;
		local textCellSpan = textCell.tag(&amp;#039;span&amp;#039;)&lt;br /&gt;
		textCellSpan&lt;br /&gt;
			.addClass(&amp;#039;mbox-text-span&amp;#039;)&lt;br /&gt;
			.wikitext(self.issue)&lt;br /&gt;
		if not self.isSmall then&lt;br /&gt;
			textCellSpan&lt;br /&gt;
				.tag(&amp;#039;span&amp;#039;)&lt;br /&gt;
					.addClass(&amp;#039;hide-when-compact&amp;#039;)&lt;br /&gt;
					.wikitext(self.talk and &amp;#039; &amp;#039; .. self.talk)&lt;br /&gt;
					.wikitext(self.fix and &amp;#039; &amp;#039; .. self.fix)&lt;br /&gt;
		end&lt;br /&gt;
		textCellSpan&lt;br /&gt;
			.wikitext(self.date and &amp;#039; &amp;#039; .. self.date)&lt;br /&gt;
		if not self.isSmall then&lt;br /&gt;
			textCellSpan&lt;br /&gt;
				.tag(&amp;#039;span&amp;#039;)&lt;br /&gt;
				.addClass(&amp;#039;hide-when-compact&amp;#039;)&lt;br /&gt;
				.wikitext(self.info and &amp;#039; &amp;#039; .. self.info)&lt;br /&gt;
		end&lt;br /&gt;
	else&lt;br /&gt;
		-- Default text formatting - anything goes.&lt;br /&gt;
		textCell&lt;br /&gt;
			.cssText(self.textstyle)&lt;br /&gt;
			.wikitext(self.text)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add the right-hand image.&lt;br /&gt;
	if self.imageRight then&lt;br /&gt;
		local imageRightCell = row.tag(&amp;#039;td&amp;#039;).addClass(&amp;#039;mbox-imageright&amp;#039;)&lt;br /&gt;
		if self.imageCellDiv then&lt;br /&gt;
			imageRightCell = imageRightCell.tag(&amp;#039;div&amp;#039;).css(&amp;#039;width&amp;#039;, &amp;#039;52px&amp;#039;) -- If we are using a div, redefine imageRightCell so that the image is inside it.&lt;br /&gt;
		end&lt;br /&gt;
		imageRightCell&lt;br /&gt;
			.wikitext(self.imageRight)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add the below row.&lt;br /&gt;
	if self.below then&lt;br /&gt;
		boxTable.tag(&amp;#039;tr&amp;#039;)&lt;br /&gt;
			.tag(&amp;#039;td&amp;#039;)&lt;br /&gt;
				.attr(&amp;#039;colspan&amp;#039;, self.imageRight and &amp;#039;3&amp;#039; or &amp;#039;2&amp;#039;)&lt;br /&gt;
				.addClass(&amp;#039;mbox-text&amp;#039;)&lt;br /&gt;
				.cssText(self.textstyle)&lt;br /&gt;
				.wikitext(self.below)&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add error message for invalid type parameters.&lt;br /&gt;
	if self.invalidTypeError then&lt;br /&gt;
		root&lt;br /&gt;
			.tag(&amp;#039;div&amp;#039;)&lt;br /&gt;
				.css(&amp;#039;text-align&amp;#039;, &amp;#039;center&amp;#039;)&lt;br /&gt;
				.wikitext(format(&amp;#039;This message box is using an invalid &amp;quot;type=%s&amp;quot; parameter and needs fixing.&amp;#039;, self.type or &amp;#039;&amp;#039;))&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	-- Add categories.&lt;br /&gt;
	root&lt;br /&gt;
		.wikitext(self.categories)&lt;br /&gt;
&lt;br /&gt;
	return tostring(root)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function main(boxType, args)&lt;br /&gt;
	box:setTitle(args)&lt;br /&gt;
	local cfg = box:getConfig(boxType)&lt;br /&gt;
	args = box:removeBlankArgs(cfg, args)&lt;br /&gt;
	box:setBoxParameters(cfg, args)&lt;br /&gt;
	return box:export()&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function makeWrapper(boxType)&lt;br /&gt;
	return function (frame)&lt;br /&gt;
		-- If called via #invoke, use the args passed into the invoking&lt;br /&gt;
		-- template, or the args passed to #invoke if any exist. Otherwise&lt;br /&gt;
		-- assume args are being passed directly in from the debug console&lt;br /&gt;
		-- or from another Lua module.&lt;br /&gt;
		local origArgs&lt;br /&gt;
		if frame == mw.getCurrentFrame() then&lt;br /&gt;
			origArgs = frame:getParent().args&lt;br /&gt;
			for k, v in pairs(frame.args) do&lt;br /&gt;
				origArgs = frame.args&lt;br /&gt;
				break&lt;br /&gt;
			end&lt;br /&gt;
		else&lt;br /&gt;
			origArgs = frame&lt;br /&gt;
		end&lt;br /&gt;
		-- Trim whitespace.&lt;br /&gt;
		local args = {}&lt;br /&gt;
		for k, v in pairs(origArgs) do&lt;br /&gt;
			if type(v) == &amp;#039;string&amp;#039; then&lt;br /&gt;
				v = trim(v)&lt;br /&gt;
			end&lt;br /&gt;
			args[k] = v&lt;br /&gt;
		end&lt;br /&gt;
		return main(boxType, args)&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local p = {&lt;br /&gt;
	main = main,&lt;br /&gt;
	mbox = makeWrapper(&amp;#039;mbox&amp;#039;)&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
for boxType in pairs(cfgTables) do&lt;br /&gt;
	p[boxType] = makeWrapper(boxType)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>imported&gt;Abhidevananda</name></author>
	</entry>
</feed>