Anonymous user
Module:Message box: Difference between revisions
ony load Category handler when needed, requested on talk page
Vivaporius (talk | contribs) m (1 revision imported) |
(ony load Category handler when needed, requested on talk page) |
||
Line 5:
require('Module:No globals')
local getArgs
local categoryHandler = require('Module:Category handler')._main▼
local yesno = require('Module:Yesno')
Line 109 ⟶ 108:
obj.categories = {}
obj.classes = {}
-- For lazy loading of [[Module:Category handler]].
obj.hasCategories = false
return setmetatable(obj, MessageBox)
Line 122 ⟶ 123:
cat = string.format('[[Category:%s]]', cat)
end
self.hasCategories = true
self.categories[ns] = self.categories[ns] or {}
table.insert(self.categories[ns], cat)
Line 429 ⟶ 431:
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
-- [[Module:Category handler]].
main = table.concat(self.categories[0] or {}),
template = table.concat(self.categories[10] or {}),
Line 495 ⟶ 503:
-- collapsible. At the moment, only ambox uses this.
textCell:cssText(self.textstyle or nil)
local
textCellDiv
:addClass('mbox-text-span')
:wikitext(self.issue or nil)
if (self.talk or self.fix) and not self.isSmall then
:addClass('hide-when-compact')
:wikitext(self.talk and (' ' .. self.talk) or nil)
:wikitext(self.fix and (' ' .. self.fix) or nil)
end
if self.info and not self.isSmall then
textCellDiv
:tag('span')
:addClass('hide-when-compact')
Line 513 ⟶ 521:
end
if self.removalNotice then
:addClass('hide-when-compact')
:tag('i')
|