Mô đun:Pp-move-indef
Tập tin:Test Template Info-Icon - Version (2).svg Tài liệu mô đun[tạo] [làm mới]
-- 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 = 'Khóa không được di chuyển'
elseif namespace == 4 or namepace == 12 then
category = 'Trang dự án bị khóa không được đổi tên'
elseif namespace == 100 then
category = 'Khóa không được di chuyển'
elseif title.isTalkPage then
category = 'Khóa không được di chuyển'
else
category = 'Khóa không được di chuyển'
end
else
category = 'Trang có tham số bản mẫu khóa trang không đúng'
end
return string.format(
'[[%s:%s|%s]]',
mw.site.namespaces[14].name, -- "Thể loại"
category,
title.text -- equivalent of {{PAGENAME}}
)
end
return p