今天是2024年6月30日 第26周 星期日

代人,时大变了。

我们生活在大地上,但我们的梦想超越天空。

模块:Redirect category shell

来自Akarin
跳到导航 跳到搜索
50px 模块文档[创建]
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 = {
		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 .. "* {{red|'''重要提示——請閱讀!{{maroon|機器人、任何自動化或半自動化過程都不應在沒有參數的情況下使用本模板。除非您想學習如何對-{zh-hans:重定向; zh-hant:重新導向;}-進行分類,否則不要在沒有參數的情況下使用它。對於想學習如何對-{zh-hans:重定向; zh-hant:重新導向;}-進行分類的編者,本模板是一種學習工具。只有那些打算返回到-{zh-hans:重定向; zh-hant:重新導向;}-以了解要使用哪個-{zh-hans:重定向; zh-hant:重新導向;}-分類的編者才應不帶參數或帶空第一個參數!}}'''}}[[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>适当时会自动检测、描述与分类[[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