Editing Module:Message box

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. Read the Privacy Policy to learn what information we collect about you and how we use it.

If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 5: Line 5:
require('Module:No globals')
require('Module:No globals')
local getArgs
local getArgs
local categoryHandler = require('Module:Category handler')._main
local yesno = require('Module:Yesno')
local yesno = require('Module:Yesno')


Line 122: Line 123:
obj.categories = {}
obj.categories = {}
obj.classes = {}
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
obj.hasCategories = false


return setmetatable(obj, MessageBox)
return setmetatable(obj, MessageBox)
Line 137: Line 136:
cat = string.format('[[Category:%s]]', cat)
cat = string.format('[[Category:%s]]', cat)
end
end
self.hasCategories = true
self.categories[ns] = self.categories[ns] or {}
self.categories[ns] = self.categories[ns] or {}
table.insert(self.categories[ns], cat)
table.insert(self.categories[ns], cat)
Line 454: Line 452:


function MessageBox:renderCategories()
function MessageBox:renderCategories()
if not self.hasCategories then
-- No categories added, no need to pass them to Category handler so,
-- if it was invoked, it would return the empty string.
-- So we shortcut and return the empty string.
return ""
end
-- Convert category tables to strings and pass them through
-- Convert category tables to strings and pass them through
-- [[Module:Category handler]].
-- [[Module:Category handler]].
return require('Module:Category handler')._main{
return categoryHandler{
main = table.concat(self.categories[0] or {}),
main = table.concat(self.categories[0] or {}),
template = table.concat(self.categories[10] or {}),
template = table.concat(self.categories[10] or {}),
Please note that all contributions to Nonbinary Wiki are considered to be released under the Creative Commons Attribution-ShareAlike (see Nonbinary Wiki:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)

Template used on this page: