模組:Redirect category shell
外观
local RCS = {}
local yesno = require('Module:Yesno')
local mError = require('Module:Error')
local mMessageBox = require('Module:Message box')
local effectiveProtectionLevel = require('Module:Effective protection level')._main
function RCS._main (template, endtext)
local mboxargslist = {
name = 'Redirect category shell',
type = 'move',
image = 'none',
style = 'margin-top: 1.1em; border: solid 1px darkblue; border-left-width: 0.5em;',
textstyle = 'padding-top: 0.9em; padding-bottom: 0.9em;'
}
local wt = '[[File:Symbol redirect arrow with gradient.svg|25px|link=]] <b>本頁面是一個[[Wikipedia:重定向|-{zh-hans:重定向; zh-hant:重新導向;}-]]:</b>\n'
if (mw.text.trim(template) == "") then
wt = wt .. "[[Category:其他重定向]]"
else
wt = wt .. template
end
if ((effectiveProtectionLevel('edit') == 'sysop') or
(effectiveProtectionLevel('edit') == 'templateeditor') or
(effectiveProtectionLevel('edit') == 'autoconfirmed') or
(effectiveProtectionLevel('move') == 'sysop') or
(effectiveProtectionLevel('move') == 'templateeditor')
) then
wt = wt ..'\n{{被保護的重定向}}\n'
else
wt = wt ..'\n'
end
if (endtext ~= nil) then
mboxargslist.text = wt .. endtext
else
mboxargslist.text = wt .. '<small>适当时会自动检测、描述与分类[[Wikipedia:保護方針|保护级别]]使用模板。</small>'
end
return mMessageBox.main('mbox', mboxargslist)
end
function RCS.main(frame)
local args = {}
for k, v in pairs( frame.args ) do
args[k] = v
end
if (args[2] ~= '') then
template = args[2]
elseif (args[1] ~= '') then
template = args[1]
else
template = ""
end
return frame:preprocess(RCS._main(template))
end
return RCS