Modul:Pp-move-indef
Pendokumenan untuk modul ini boleh diciptakan di Modul:Pp-move-indef/doc
-- 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 = 'Pengguna dan laman perbincangan pengguna Wikipedia yang dilindungi dari dipindahkan'
elseif namespace == 4 or namepace == 12 then
category = 'Laman projek Wikipedia yang dilindungi dari dipindahkan'
elseif namespace == 100 then
category = 'Portal Wikipedia yang dilindungi dari dipindahkan'
elseif title.isTalkPage then
category = 'Laman perbincangan Wikipedia yang dilindungi dari dipindahkan'
else
category = 'Laman Wikipedia yang dilindungi dari dipindahkan selamanya'
end
else
category = 'Laman Wikipedia dengan templat perlindungan yang salah'
end
return string.format(
'[[%s:%s|%s]]',
mw.site.namespaces[14].name, -- "Category"
category,
title.text -- equivalent of {{PAGENAME}}
)
end
return p