http://proplan.55bet-pro.com/wiki/index.php?action=history&feed=atom&title=M%C3%B3dulo%3AMessage_box Módulo:Message box - Histórico de revisão-55BET Pro 2026-03-17T15:54:46Z Histórico de revisões para esta página neste wiki MediaWiki 1.42.7 http://proplan.55bet-pro.com/wiki/index.php?title=M%C3%B3dulo:Message_box&diff=57&oldid=prev Módulo:Message box - Histórico de revisão-55BET Pro 2024-06-27T11:08:09Z <p>uma edição</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <tr class="diff-title" lang="pt-BR"> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">← Edição anterior</td> <td colspan="1" style="background-color: #fff; color: #202122; text-align: center;">Edição das 08h08min de 27 de junho de 2024</td> </tr><tr><td colspan="2" class="diff-notice" lang="pt-BR"><div class="mw-diff-empty">(Sem diferença)</div> </td></tr></table> Henryzord http://proplan.55bet-pro.com/wiki/index.php?title=M%C3%B3dulo:Message_box&diff=56&oldid=prev Módulo:Message box - Histórico de revisão-55BET Pro 2023-09-02T22:54:30Z <p><a href="/wiki/index.php?title=Arquivo:Cscr-featured.svg&amp;action=edit&amp;redlink=1" class="new" title="Arquivo:Cscr-featured.svg (página inexistente)">File:Cscr-featured.svg</a> needs a link to the description page for license and attribution. Add the ability for the configuration to specify a flag to accomplish this.</p> <p><b>Página nova</b></p><div>require(&#039;strict&#039;)<br /> local getArgs<br /> local yesno = require(&#039;Module:Yesno&#039;)<br /> local lang = mw.language.getContentLanguage()<br /> <br /> local CONFIG_MODULE = &#039;Module:Message box/configuration&#039;<br /> local DEMOSPACES = {talk = &#039;tmbox&#039;, image = &#039;imbox&#039;, file = &#039;imbox&#039;, category = &#039;cmbox&#039;, article = &#039;ambox&#039;, main = &#039;ambox&#039;}<br /> <br /> --------------------------------------------------------------------------------<br /> -- Helper functions<br /> --------------------------------------------------------------------------------<br /> <br /> local function getTitleObject(...)<br /> -- Get the title object, passing the function through pcall<br /> -- in case we are over the expensive function count limit.<br /> local success, title = pcall(mw.title.new, ...)<br /> if success then<br /> return title<br /> end<br /> end<br /> <br /> local function union(t1, t2)<br /> -- Returns the union of two arrays.<br /> local vals = {}<br /> for i, v in ipairs(t1) do<br /> vals[v] = true<br /> end<br /> for i, v in ipairs(t2) do<br /> vals[v] = true<br /> end<br /> local ret = {}<br /> for k in pairs(vals) do<br /> table.insert(ret, k)<br /> end<br /> table.sort(ret)<br /> return ret<br /> end<br /> <br /> local function getArgNums(args, prefix)<br /> local nums = {}<br /> for k, v in pairs(args) do<br /> local num = mw.ustring.match(tostring(k), &#039;^&#039; .. prefix .. &#039;([1-9]%d*)$&#039;)<br /> if num then<br /> table.insert(nums, tonumber(num))<br /> end<br /> end<br /> table.sort(nums)<br /> return nums<br /> end<br /> <br /> --------------------------------------------------------------------------------<br /> -- Box class definition<br /> --------------------------------------------------------------------------------<br /> <br /> local MessageBox = {}<br /> MessageBox.__index = MessageBox<br /> <br /> function MessageBox.new(boxType, args, cfg)<br /> args = args or {}<br /> local obj = {}<br /> <br /> -- Set the title object and the namespace.<br /> obj.title = getTitleObject(args.page) or mw.title.getCurrentTitle()<br /> <br /> -- Set the config for our box type.<br /> obj.cfg = cfg[boxType]<br /> if not obj.cfg then<br /> local ns = obj.title.namespace<br /> -- boxType is &quot;mbox&quot; or invalid input<br /> if args.demospace and args.demospace ~= &#039;&#039; then<br /> -- implement demospace parameter of mbox<br /> local demospace = string.lower(args.demospace)<br /> if DEMOSPACES[demospace] then<br /> -- use template from DEMOSPACES<br /> obj.cfg = cfg[DEMOSPACES[demospace]]<br /> elseif string.find( demospace, &#039;talk&#039; ) then<br /> -- demo as a talk page<br /> obj.cfg = cfg.tmbox<br /> else<br /> -- default to ombox<br /> obj.cfg = cfg.ombox<br /> end<br /> elseif ns == 0 then<br /> obj.cfg = cfg.ambox -- main namespace<br /> elseif ns == 6 then<br /> obj.cfg = cfg.imbox -- file namespace<br /> elseif ns == 14 then<br /> obj.cfg = cfg.cmbox -- category namespace<br /> else<br /> local nsTable = mw.site.namespaces[ns]<br /> if nsTable and nsTable.isTalk then<br /> obj.cfg = cfg.tmbox -- any talk namespace<br /> else<br /> obj.cfg = cfg.ombox -- other namespaces or invalid input<br /> end<br /> end<br /> end<br /> <br /> -- Set the arguments, and remove all blank arguments except for the ones<br /> -- listed in cfg.allowBlankParams.<br /> do<br /> local newArgs = {}<br /> for k, v in pairs(args) do<br /> if v ~= &#039;&#039; then<br /> newArgs[k] = v<br /> end<br /> end<br /> for i, param in ipairs(obj.cfg.allowBlankParams or {}) do<br /> newArgs[param] = args[param]<br /> end<br /> obj.args = newArgs<br /> end<br /> <br /> -- Define internal data structure.<br /> obj.categories = {}<br /> obj.classes = {}<br /> -- For lazy loading of [[Module:Category handler]].<br /> obj.hasCategories = false<br /> <br /> return setmetatable(obj, MessageBox)<br /> end<br /> <br /> function MessageBox:addCat(ns, cat, sort)<br /> if not cat then<br /> return nil<br /> end<br /> if sort then<br /> cat = string.format(&#039;[[Category:%s|%s]]&#039;, cat, sort)<br /> else<br /> cat = string.format(&#039;[[Category:%s]]&#039;, cat)<br /> end<br /> self.hasCategories = true<br /> self.categories[ns] = self.categories[ns] or {}<br /> table.insert(self.categories[ns], cat)<br /> end<br /> <br /> function MessageBox:addClass(class)<br /> if not class then<br /> return nil<br /> end<br /> table.insert(self.classes, class)<br /> end<br /> <br /> function MessageBox:setParameters()<br /> local args = self.args<br /> local cfg = self.cfg<br /> <br /> -- Get type data.<br /> self.type = args.type<br /> local typeData = cfg.types[self.type]<br /> self.invalidTypeError = cfg.showInvalidTypeError<br /> and self.type<br /> and not typeData<br /> typeData = typeData or cfg.types[cfg.default]<br /> self.typeClass = typeData.class<br /> self.typeImage = typeData.image<br /> self.typeImageNeedsLink = typeData.imageNeedsLink<br /> <br /> -- Find if the box has been wrongly substituted.<br /> self.isSubstituted = cfg.substCheck and args.subst == &#039;SUBST&#039;<br /> <br /> -- Find whether we are using a small message box.<br /> self.isSmall = cfg.allowSmall and (<br /> cfg.smallParam and args.small == cfg.smallParam<br /> or not cfg.smallParam and yesno(args.small)<br /> )<br /> <br /> -- Add attributes, classes and styles.<br /> self.id = args.id<br /> self.name = args.name<br /> if self.name then<br /> self:addClass(&#039;box-&#039; .. string.gsub(self.name,&#039; &#039;,&#039;_&#039;))<br /> end<br /> if yesno(args.plainlinks) ~= false then<br /> self:addClass(&#039;plainlinks&#039;)<br /> end<br /> for _, class in ipairs(cfg.classes or {}) do<br /> self:addClass(class)<br /> end<br /> if self.isSmall then<br /> self:addClass(cfg.smallClass or &#039;mbox-small&#039;)<br /> end<br /> self:addClass(self.typeClass)<br /> self:addClass(args.class)<br /> self.style = args.style<br /> self.attrs = args.attrs<br /> <br /> -- Set text style.<br /> self.textstyle = args.textstyle<br /> <br /> -- Find if we are on the template page or not. This functionality is only<br /> -- used if useCollapsibleTextFields is set, or if both cfg.templateCategory<br /> -- and cfg.templateCategoryRequireName are set.<br /> self.useCollapsibleTextFields = cfg.useCollapsibleTextFields<br /> if self.useCollapsibleTextFields<br /> or cfg.templateCategory<br /> and cfg.templateCategoryRequireName<br /> then<br /> if self.name then<br /> local templateName = mw.ustring.match(<br /> self.name,<br /> &#039;^[tT][eE][mM][pP][lL][aA][tT][eE][%s_]*:[%s_]*(.*)$&#039;<br /> ) or self.name<br /> templateName = &#039;Template:&#039; .. templateName<br /> self.templateTitle = getTitleObject(templateName)<br /> end<br /> self.isTemplatePage = self.templateTitle<br /> and mw.title.equals(self.title, self.templateTitle)<br /> end<br /> <br /> -- Process data for collapsible text fields. At the moment these are only<br /> -- used in {{ambox}}.<br /> if self.useCollapsibleTextFields then<br /> -- Get the self.issue value.<br /> if self.isSmall and args.smalltext then<br /> self.issue = args.smalltext<br /> else<br /> local sect<br /> if args.sect == &#039;&#039; then<br /> sect = &#039;This &#039; .. (cfg.sectionDefault or &#039;page&#039;)<br /> elseif type(args.sect) == &#039;string&#039; then<br /> sect = &#039;This &#039; .. args.sect<br /> end<br /> local issue = args.issue<br /> issue = type(issue) == &#039;string&#039; and issue ~= &#039;&#039; and issue or nil<br /> local text = args.text<br /> text = type(text) == &#039;string&#039; and text or nil<br /> local issues = {}<br /> table.insert(issues, sect)<br /> table.insert(issues, issue)<br /> table.insert(issues, text)<br /> self.issue = table.concat(issues, &#039; &#039;)<br /> end<br /> <br /> -- Get the self.talk value.<br /> local talk = args.talk<br /> -- Show talk links on the template page or template subpages if the talk<br /> -- parameter is blank.<br /> if talk == &#039;&#039;<br /> and self.templateTitle<br /> and (<br /> mw.title.equals(self.templateTitle, self.title)<br /> or self.title:isSubpageOf(self.templateTitle)<br /> )<br /> then<br /> talk = &#039;#&#039;<br /> elseif talk == &#039;&#039; then<br /> talk = nil<br /> end<br /> if talk then<br /> -- If the talk value is a talk page, make a link to that page. Else<br /> -- assume that it&#039;s a section heading, and make a link to the talk<br /> -- page of the current page with that section heading.<br /> local talkTitle = getTitleObject(talk)<br /> local talkArgIsTalkPage = true<br /> if not talkTitle or not talkTitle.isTalkPage then<br /> talkArgIsTalkPage = false<br /> talkTitle = getTitleObject(<br /> self.title.text,<br /> mw.site.namespaces[self.title.namespace].talk.id<br /> )<br /> end<br /> if talkTitle and talkTitle.exists then<br /> local talkText<br /> if self.isSmall then<br /> local talkLink = talkArgIsTalkPage and talk or (talkTitle.prefixedText .. &#039;#&#039; .. talk)<br /> talkText = string.format(&#039;([[%s|talk]])&#039;, talkLink)<br /> else<br /> talkText = &#039;Relevant discussion may be found on&#039;<br /> if talkArgIsTalkPage then<br /> talkText = string.format(<br /> &#039;%s [[%s|%s]].&#039;,<br /> talkText,<br /> talk,<br /> talkTitle.prefixedText<br /> )<br /> else<br /> talkText = string.format(<br /> &#039;%s the [[%s#%s|talk page]].&#039;,<br /> talkText,<br /> talkTitle.prefixedText,<br /> talk<br /> )<br /> end<br /> end<br /> self.talk = talkText<br /> end<br /> end<br /> <br /> -- Get other values.<br /> self.fix = args.fix ~= &#039;&#039; and args.fix or nil<br /> local date<br /> if args.date and args.date ~= &#039;&#039; then<br /> date = args.date<br /> elseif args.date == &#039;&#039; and self.isTemplatePage then<br /> date = lang:formatDate(&#039;F Y&#039;)<br /> end<br /> if date then<br /> self.date = string.format(&quot; &lt;span class=&#039;date-container&#039;&gt;&lt;i&gt;(&lt;span class=&#039;date&#039;&gt;%s&lt;/span&gt;)&lt;/i&gt;&lt;/span&gt;&quot;, date)<br /> end<br /> self.info = args.info<br /> if yesno(args.removalnotice) then<br /> self.removalNotice = cfg.removalNotice<br /> end<br /> end<br /> <br /> -- Set the non-collapsible text field. At the moment this is used by all box<br /> -- types other than ambox, and also by ambox when small=yes.<br /> if self.isSmall then<br /> self.text = args.smalltext or args.text<br /> else<br /> self.text = args.text<br /> end<br /> <br /> -- Set the below row.<br /> self.below = cfg.below and args.below<br /> <br /> -- General image settings.<br /> self.imageCellDiv = not self.isSmall and cfg.imageCellDiv<br /> self.imageEmptyCell = cfg.imageEmptyCell<br /> <br /> -- Left image settings.<br /> local imageLeft = self.isSmall and args.smallimage or args.image<br /> if cfg.imageCheckBlank and imageLeft ~= &#039;blank&#039; and imageLeft ~= &#039;none&#039;<br /> or not cfg.imageCheckBlank and imageLeft ~= &#039;none&#039;<br /> then<br /> self.imageLeft = imageLeft<br /> if not imageLeft then<br /> local imageSize = self.isSmall<br /> and (cfg.imageSmallSize or &#039;30x30px&#039;)<br /> or &#039;40x40px&#039;<br /> self.imageLeft = string.format(&#039;[[File:%s|%s%s|alt=]]&#039;, self.typeImage<br /> or &#039;Information icon4.svg&#039;, imageSize, self.typeImageNeedsLink and &quot;&quot; or &quot;|link=&quot; )<br /> end<br /> end<br /> <br /> -- Right image settings.<br /> local imageRight = self.isSmall and args.smallimageright or args.imageright<br /> if not (cfg.imageRightNone and imageRight == &#039;none&#039;) then<br /> self.imageRight = imageRight<br /> end<br /> <br /> -- set templatestyles<br /> self.base_templatestyles = cfg.templatestyles<br /> self.templatestyles = args.templatestyles<br /> end<br /> <br /> function MessageBox:setMainspaceCategories()<br /> local args = self.args<br /> local cfg = self.cfg<br /> <br /> if not cfg.allowMainspaceCategories then<br /> return nil<br /> end<br /> <br /> local nums = {}<br /> for _, prefix in ipairs{&#039;cat&#039;, &#039;category&#039;, &#039;all&#039;} do<br /> args[prefix .. &#039;1&#039;] = args[prefix]<br /> nums = union(nums, getArgNums(args, prefix))<br /> end<br /> <br /> -- The following is roughly equivalent to the old {{Ambox/category}}.<br /> local date = args.date<br /> date = type(date) == &#039;string&#039; and date<br /> local preposition = &#039;from&#039;<br /> for _, num in ipairs(nums) do<br /> local mainCat = args[&#039;cat&#039; .. tostring(num)]<br /> or args[&#039;category&#039; .. tostring(num)]<br /> local allCat = args[&#039;all&#039; .. tostring(num)]<br /> mainCat = type(mainCat) == &#039;string&#039; and mainCat<br /> allCat = type(allCat) == &#039;string&#039; and allCat<br /> if mainCat and date and date ~= &#039;&#039; then<br /> local catTitle = string.format(&#039;%s %s %s&#039;, mainCat, preposition, date)<br /> self:addCat(0, catTitle)<br /> catTitle = getTitleObject(&#039;Category:&#039; .. catTitle)<br /> if not catTitle or not catTitle.exists then<br /> self:addCat(0, &#039;Articles with invalid date parameter in template&#039;)<br /> end<br /> elseif mainCat and (not date or date == &#039;&#039;) then<br /> self:addCat(0, mainCat)<br /> end<br /> if allCat then<br /> self:addCat(0, allCat)<br /> end<br /> end<br /> end<br /> <br /> function MessageBox:setTemplateCategories()<br /> local args = self.args<br /> local cfg = self.cfg<br /> <br /> -- Add template categories.<br /> if cfg.templateCategory then<br /> if cfg.templateCategoryRequireName then<br /> if self.isTemplatePage then<br /> self:addCat(10, cfg.templateCategory)<br /> end<br /> elseif not self.title.isSubpage then<br /> self:addCat(10, cfg.templateCategory)<br /> end<br /> end<br /> <br /> -- Add template error categories.<br /> if cfg.templateErrorCategory then<br /> local templateErrorCategory = cfg.templateErrorCategory<br /> local templateCat, templateSort<br /> if not self.name and not self.title.isSubpage then<br /> templateCat = templateErrorCategory<br /> elseif self.isTemplatePage then<br /> local paramsToCheck = cfg.templateErrorParamsToCheck or {}<br /> local count = 0<br /> for i, param in ipairs(paramsToCheck) do<br /> if not args[param] then<br /> count = count + 1<br /> end<br /> end<br /> if count &gt; 0 then<br /> templateCat = templateErrorCategory<br /> templateSort = tostring(count)<br /> end<br /> if self.categoryNums and #self.categoryNums &gt; 0 then<br /> templateCat = templateErrorCategory<br /> templateSort = &#039;C&#039;<br /> end<br /> end<br /> self:addCat(10, templateCat, templateSort)<br /> end<br /> end<br /> <br /> function MessageBox:setAllNamespaceCategories()<br /> -- Set categories for all namespaces.<br /> if self.invalidTypeError then<br /> local allSort = (self.title.namespace == 0 and &#039;Main:&#039; or &#039;&#039;) .. self.title.prefixedText<br /> self:addCat(&#039;all&#039;, &#039;Wikipedia message box parameter needs fixing&#039;, allSort)<br /> end<br /> if self.isSubstituted then<br /> self:addCat(&#039;all&#039;, &#039;Pages with incorrectly substituted templates&#039;)<br /> end<br /> end<br /> <br /> function MessageBox:setCategories()<br /> if self.title.namespace == 0 then<br /> self:setMainspaceCategories()<br /> elseif self.title.namespace == 10 then<br /> self:setTemplateCategories()<br /> end<br /> self:setAllNamespaceCategories()<br /> end<br /> <br /> function MessageBox:renderCategories()<br /> if not self.hasCategories then<br /> -- No categories added, no need to pass them to Category handler so,<br /> -- if it was invoked, it would return the empty string.<br /> -- So we shortcut and return the empty string.<br /> return &quot;&quot;<br /> end<br /> -- Convert category tables to strings and pass them through<br /> -- [[Module:Category handler]].<br /> return require(&#039;Module:Category handler&#039;)._main{<br /> main = table.concat(self.categories[0] or {}),<br /> template = table.concat(self.categories[10] or {}),<br /> all = table.concat(self.categories.all or {}),<br /> nocat = self.args.nocat,<br /> page = self.args.page<br /> }<br /> end<br /> <br /> function MessageBox:export()<br /> local root = mw.html.create()<br /> <br /> -- Add the subst check error.<br /> if self.isSubstituted and self.name then<br /> root:tag(&#039;b&#039;)<br /> :addClass(&#039;error&#039;)<br /> :wikitext(string.format(<br /> &#039;Template &lt;code&gt;%s[[Template:%s|%s]]%s&lt;/code&gt; has been incorrectly substituted.&#039;,<br /> mw.text.nowiki(&#039;{{&#039;), self.name, self.name, mw.text.nowiki(&#039;}}&#039;)<br /> ))<br /> end<br /> <br /> local frame = mw.getCurrentFrame()<br /> root:wikitext(frame:extensionTag{<br /> name = &#039;templatestyles&#039;,<br /> args = { src = self.base_templatestyles },<br /> })<br /> -- Add support for a single custom templatestyles sheet. Undocumented as<br /> -- need should be limited and many templates using mbox are substed; we<br /> -- don&#039;t want to spread templatestyles sheets around to arbitrary places<br /> if self.templatestyles then<br /> root:wikitext(frame:extensionTag{<br /> name = &#039;templatestyles&#039;,<br /> args = { src = self.templatestyles },<br /> })<br /> end<br /> <br /> -- Create the box table.<br /> local boxTable = root:tag(&#039;table&#039;)<br /> boxTable:attr(&#039;id&#039;, self.id or nil)<br /> for i, class in ipairs(self.classes or {}) do<br /> boxTable:addClass(class or nil)<br /> end<br /> boxTable<br /> :cssText(self.style or nil)<br /> :attr(&#039;role&#039;, &#039;presentation&#039;)<br /> <br /> if self.attrs then<br /> boxTable:attr(self.attrs)<br /> end<br /> <br /> -- Add the left-hand image.<br /> local row = boxTable:tag(&#039;tr&#039;)<br /> if self.imageLeft then<br /> local imageLeftCell = row:tag(&#039;td&#039;):addClass(&#039;mbox-image&#039;)<br /> if self.imageCellDiv then<br /> -- If we are using a div, redefine imageLeftCell so that the image<br /> -- is inside it. Divs use style=&quot;width: 52px;&quot;, which limits the<br /> -- image width to 52px. If any images in a div are wider than that,<br /> -- they may overlap with the text or cause other display problems.<br /> imageLeftCell = imageLeftCell:tag(&#039;div&#039;):addClass(&#039;mbox-image-div&#039;)<br /> end<br /> imageLeftCell:wikitext(self.imageLeft or nil)<br /> elseif self.imageEmptyCell then<br /> -- Some message boxes define an empty cell if no image is specified, and<br /> -- some don&#039;t. The old template code in templates where empty cells are<br /> -- specified gives the following hint: &quot;No image. Cell with some width<br /> -- or padding necessary for text cell to have 100% width.&quot;<br /> row:tag(&#039;td&#039;)<br /> :addClass(&#039;mbox-empty-cell&#039;)<br /> end<br /> <br /> -- Add the text.<br /> local textCell = row:tag(&#039;td&#039;):addClass(&#039;mbox-text&#039;)<br /> if self.useCollapsibleTextFields then<br /> -- The message box uses advanced text parameters that allow things to be<br /> -- collapsible. At the moment, only ambox uses this.<br /> textCell:cssText(self.textstyle or nil)<br /> local textCellDiv = textCell:tag(&#039;div&#039;)<br /> textCellDiv<br /> :addClass(&#039;mbox-text-span&#039;)<br /> :wikitext(self.issue or nil)<br /> if (self.talk or self.fix) then<br /> textCellDiv:tag(&#039;span&#039;)<br /> :addClass(&#039;hide-when-compact&#039;)<br /> :wikitext(self.talk and (&#039; &#039; .. self.talk) or nil)<br /> :wikitext(self.fix and (&#039; &#039; .. self.fix) or nil)<br /> end<br /> textCellDiv:wikitext(self.date and (&#039; &#039; .. self.date) or nil)<br /> if self.info and not self.isSmall then<br /> textCellDiv<br /> :tag(&#039;span&#039;)<br /> :addClass(&#039;hide-when-compact&#039;)<br /> :wikitext(self.info and (&#039; &#039; .. self.info) or nil)<br /> end<br /> if self.removalNotice then<br /> textCellDiv:tag(&#039;span&#039;)<br /> :addClass(&#039;hide-when-compact&#039;)<br /> :tag(&#039;i&#039;)<br /> :wikitext(string.format(&quot; (%s)&quot;, self.removalNotice))<br /> end<br /> else<br /> -- Default text formatting - anything goes.<br /> textCell<br /> :cssText(self.textstyle or nil)<br /> :wikitext(self.text or nil)<br /> end<br /> <br /> -- Add the right-hand image.<br /> if self.imageRight then<br /> local imageRightCell = row:tag(&#039;td&#039;):addClass(&#039;mbox-imageright&#039;)<br /> if self.imageCellDiv then<br /> -- If we are using a div, redefine imageRightCell so that the image<br /> -- is inside it.<br /> imageRightCell = imageRightCell:tag(&#039;div&#039;):addClass(&#039;mbox-image-div&#039;)<br /> end<br /> imageRightCell<br /> :wikitext(self.imageRight or nil)<br /> end<br /> <br /> -- Add the below row.<br /> if self.below then<br /> boxTable:tag(&#039;tr&#039;)<br /> :tag(&#039;td&#039;)<br /> :attr(&#039;colspan&#039;, self.imageRight and &#039;3&#039; or &#039;2&#039;)<br /> :addClass(&#039;mbox-text&#039;)<br /> :cssText(self.textstyle or nil)<br /> :wikitext(self.below or nil)<br /> end<br /> <br /> -- Add error message for invalid type parameters.<br /> if self.invalidTypeError then<br /> root:tag(&#039;div&#039;)<br /> :addClass(&#039;mbox-invalid-type&#039;)<br /> :wikitext(string.format(<br /> &#039;This message box is using an invalid &quot;type=%s&quot; parameter and needs fixing.&#039;,<br /> self.type or &#039;&#039;<br /> ))<br /> end<br /> <br /> -- Add categories.<br /> root:wikitext(self:renderCategories() or nil)<br /> <br /> return tostring(root)<br /> end<br /> <br /> --------------------------------------------------------------------------------<br /> -- Exports<br /> --------------------------------------------------------------------------------<br /> <br /> local p, mt = {}, {}<br /> <br /> function p._exportClasses()<br /> -- For testing.<br /> return {<br /> MessageBox = MessageBox<br /> }<br /> end<br /> <br /> function p.main(boxType, args, cfgTables)<br /> local box = MessageBox.new(boxType, args, cfgTables or mw.loadData(CONFIG_MODULE))<br /> box:setParameters()<br /> box:setCategories()<br /> return box:export()<br /> end<br /> <br /> function mt.__index(t, k)<br /> return function (frame)<br /> if not getArgs then<br /> getArgs = require(&#039;Module:Arguments&#039;).getArgs<br /> end<br /> return t.main(k, getArgs(frame, {trim = false, removeBlanks = false}))<br /> end<br /> end<br /> <br /> return setmetatable(p, mt)</div> infobox>Anomie