Module:Message box: Difference between revisions
on second thoughts, I like this way of passing params to category handler better
m>Mr. Stradivarius m (fix brackets) |
m>Mr. Stradivarius (on second thoughts, I like this way of passing params to category handler better) |
||
Line 128: | Line 128: | ||
function box:setTitle(args) | function box:setTitle(args) | ||
-- Get the title object and the namespace. | -- Get the title object and the namespace. | ||
self.pageTitle = getTitleObject(args.page ~= '' and args.page) | |||
self.title = pageTitle or mw.title.getCurrentTitle() | self.title = self.pageTitle or mw.title.getCurrentTitle() | ||
self.demospace = args.demospace ~= '' and args.demospace or nil | |||
self.nsid = demospace or self.title.namespace | self.nsid = box.getNamespaceId(self.demospace) or self.title.namespace | ||
end | end | ||
Line 383: | Line 383: | ||
-- Convert category tables to strings and pass them through [[Module:Category handler]]. | -- Convert category tables to strings and pass them through [[Module:Category handler]]. | ||
self.categories = categoryHandler{ | self.categories = categoryHandler{ | ||
main = tconcat(self.mainCats or {}), | main = tconcat(self.mainCats or {}), | ||
Line 396: | Line 388: | ||
all = tconcat(self.allCats or {}), | all = tconcat(self.allCats or {}), | ||
nocat = args.nocat, | nocat = args.nocat, | ||
demospace = | demospace = self.demospace, | ||
page = | page = self.pageTitle and pageTitle.prefixedText or nil | ||
} | } | ||
end | end |