模块: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>本页面是一个[[Qiuwen:重定向|重定向]]:</b>\n'
	if (mw.text.trim(template) == "") then
		wt = wt .. "[[Category:其他重定向]]"
	else
		wt = wt .. template .. '{{Redirect template\n|name=多种类型重定向\n|from=带有多种类型\n|all category=带有多种类型的重定向\n}}'
	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>适当时会自动检测、描述与分类[[Qiuwen:保护方针|保护级别]]使用模板。</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