This is a mirror of discontinued 'WikiDevi'. Enjoy!
Module:Pp-move-indef
This module implements {{pp-move-indef}}. It is a protection template, but has no visible output, unlike other protection templates which output banners or padlock icons. The only output is a category.
If the page is move-protected with either full move protection or template move protection, the module outputs one of the following categories, depending on the namespace it is used in:
- Category:WikiDevi indefinitely move-protected pages
- Category:WikiDevi move-protected talk pages
- Category:WikiDevi move-protected user and user talk pages
- Category:WikiDevi move-protected project pages
- Category:WikiDevi move-protected portals
On pages that are not full-move-protected or template-move-protected, the module outputs Category:WikiDevi pages with incorrect protection templates.
Usage
From wikitext
The usual way to use this module from wikitext is with the {{pp-move-indef}} template. You can also use it from #invoke directly with the code {{#invoke:pp-move-indef|main}}. Neither of these take any parameters, and both only work on the current page.
From Lua
From Lua, load the module like this:
local ppMoveIndef = require('Module:Pp-move-indef').main
You can then use ppMoveIndef like this:
ppMoveIndef(title)
The title parameter is an optional title object, used for testing purposes. If no parameters are supplied the module works on the current page.
| The above documentation is transcluded from Module:Pp-move-indef/doc. (edit | history) Editors can experiment in this module's sandbox (create | mirror) and testcases (create) pages. Subpages of this module. |
-- 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 = 'WikiDevi move-protected user and user talk pages'
elseif namespace == 4 or namepace == 12 then
category = 'WikiDevi move-protected project pages'
elseif namespace == 100 then
category = 'WikiDevi move-protected portals'
elseif title.isTalkPage then
category = 'WikiDevi move-protected talk pages'
else
category = 'WikiDevi indefinitely move-protected pages'
end
else
category = 'WikiDevi pages with incorrect protection templates'
end
return string.format(
'[[%s:%s|%s]]',
mw.site.namespaces[14].name, -- "Category"
category,
title.text -- equivalent of {{PAGENAME}}
)
end
return p