Module:Pp-move-indef: Difference between revisions
Chalochatu (talk | contribs) (Created page with "-- This module implements Template:Pp-move-indef. local p = {} function p.main(title) if type(title) == 'string' then title = mw.title.new(title) elseif type(title)...") |
No edit summary |
||
Line 21: | Line 21: | ||
if level == 'sysop' or level == 'templateeditor' then | if level == 'sysop' or level == 'templateeditor' then | ||
if namespace == 2 or namespace == 3 then | if namespace == 2 or namespace == 3 then | ||
category = ' | category = 'Chalo Chatu move-protected user and user talk pages' | ||
elseif namespace == 4 or namepace == 12 then | elseif namespace == 4 or namepace == 12 then | ||
category = ' | category = 'Chalo Chatu move-protected project pages' | ||
elseif namespace == 100 then | elseif namespace == 100 then | ||
category = ' | category = 'Chalo Chatu move-protected portals' | ||
elseif title.isTalkPage then | elseif title.isTalkPage then | ||
category = ' | category = 'Chalo Chatu move-protected talk pages' | ||
else | else | ||
category = ' | category = 'Chalo Chatu indefinitely move-protected pages' | ||
end | end | ||
else | else | ||
category = ' | category = 'Chalo Chatu pages with incorrect protection templates' | ||
end | end | ||
Latest revision as of 14:00, 27 July 2016
-- This module implements Template:Pp-move-indef.
local p = {}
function p.main(title) if type(title) == 'string' then title = mw.title.new(title) elseif type(title) ~= 'table' or not title.text or not title.getContent then -- The title parameter is absent or not a title object. It could be a -- frame object if we are being called from #invoke. title = mw.title.getCurrentTitle() end
local level = title and title.protectionLevels and title.protectionLevels.move and title.protectionLevels.move[1] local namespace = title and title.namespace
local category if level == 'sysop' or level == 'templateeditor' then if namespace == 2 or namespace == 3 then category = 'Chalo Chatu move-protected user and user talk pages' elseif namespace == 4 or namepace == 12 then category = 'Chalo Chatu move-protected project pages' elseif namespace == 100 then category = 'Chalo Chatu move-protected portals' elseif title.isTalkPage then category = 'Chalo Chatu move-protected talk pages' else category = 'Chalo Chatu indefinitely move-protected pages' end else category = 'Chalo Chatu pages with incorrect protection templates' end
return string.format( '%s', mw.site.namespaces[14].name, -- "Category" category, title.text -- equivalent of Pp-move-indef ) end
return p