Module:Userbox: Difference between revisions

Jump to navigation Jump to search
m (1 revision imported)
Line 345: Line 345:
cats[#cats + 1] = args.usercategory4
cats[#cats + 1] = args.usercategory4
cats[#cats + 1] = args.usercategory5
cats[#cats + 1] = args.usercategory5
if #cats > 0 then
-- Get the title object
-- Get the title object
local title
local title
if page then
if page then
title = mw.title.new(page)
title = mw.title.new(page)
else
title = mw.title.getCurrentTitle()
end
-- Build category handler arguments.
local chargs = {}
chargs.page = page
chargs.nocat = args.nocat
chargs.main = '[[Category:Pages with misplaced templates]]'
if args.notcatsubpages then
chargs.subpage = 'no'
end
-- User namespace.
local user = ''
for i, cat in ipairs(cats) do
user = user .. makeCat(cat)
end
chargs.user = user
-- Template namespace.
local basepage = title.baseText
local template = ''
for i, cat in ipairs(cats) do
template = template .. makeCat(cat, ' ' .. basepage)
end
chargs.template = template
return categoryHandler(chargs)
else
else
return nil
title = mw.title.getCurrentTitle()
end
end
-- Build category handler arguments.
local chargs = {}
chargs.page = page
chargs.nocat = args.nocat
chargs.main = '[[Category:Pages with templates in the wrong namespace]]'
if args.notcatsubpages then
chargs.subpage = 'no'
end
-- User namespace.
local user = ''
for i, cat in ipairs(cats) do
user = user .. makeCat(cat)
end
chargs.user = user
-- Template namespace.
local basepage = title.baseText
local template = ''
for i, cat in ipairs(cats) do
template = template .. makeCat(cat, ' ' .. basepage)
end
chargs.template = template
return categoryHandler(chargs)
end
end


return p
return p