Template:Userbox: Difference between revisions
Jump to navigation
Jump to search
(Replaced content with "{{#invoke:userbox|userbox}}") Tag: Replaced |
No edit summary |
||
Line 1: | Line 1: | ||
{ | -- Get the title object | ||
local title | |||
if page then | |||
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 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 | |||
return p |
Revision as of 23:29, 6 February 2025
-- Get the title object local title if page then 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 = 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
return p