请输入您要查询的百科知识:

 

词条 Module:RfD
释义

require('Module:No globals')

local p = {}

local getTargetFromText = require('Module:Redirect').getTargetFromText

local messageBox

local mboxText = "%sThe purpose of this redirect is currently being discussed by the Wikipedia community."

.. " The outcome of the discussion may result in a change of this page, or possibly its deletion in accordance with Wikipedia's deletion policy.
"

.. " Please share your thoughts on the matter at this redirect's entry on the Redirects for discussion page.
"

.. " Click on the link below to go to the current destination page.
"

.. "Please notify the good-faith creator and any main contributors of the redirect by placing {{subst:RFDNote|%s}} ~~~~ on their talk page."

local errorMessage = 'Error: Unable to determine the redirect\\'s target. If this page is a soft redirect, then this error can be ignored. Otherwise, please make sure that the instructions for placing this tag were followed correctly, in particular that the redirect\\'s old content was passed in the content parameter.
'

local deleteReason = 'Redirects for discussion debate closed as delete'

local messageOnTransclusions = '

'

local function makeRfdNotice(args)

local currentTitle = mw.title.getCurrentTitle()

if not messageBox then

messageBox = require('Module:Message box')

end

local discussionPage = args[1] and mw.text.trim(args[1])

if discussionPage == then

discussionPage = nil

end

local target = getTargetFromText(args.content)

local isError = not target or not mw.title.new(target)

local category

if args.category then

category = args.category

elseif args.month and args.year then

category = string.format(, args.month, args.year, currentTitle.text, currentTitle.text)

else

category = string.format(, currentTitle.text, currentTitle.text)

end

if category then category = category.. end

return string.format('%s%s%s',

messageBox.main('mbox', {

type = 'delete',

image = 'none',

text = string.format(mboxText, isError and errorMessage or , args.year, args.month, args.day, discussionPage or currentTitle.prefixedText, mw.text.nowiki(currentTitle.prefixedText))

}),

mw.uri.encode(deleteReason),

category,

isError and or

)

end

p[] = function(frame)

local args = frame.args

if not args.content or mw.text.trim(args.content) == then

return 'Error: No content was provided. The original text of the page (the #REDIRECT line and any templates) must be placed inside of the content parameter.'

end

local pframe = frame:getParent()

if pframe:preprocess('1') == '1' then

-- We're being transcluded, so display the content of our target.

local target = getTargetFromText(args.content)

if target then

target = mw.title.new(target)

end

local redirect = pframe:getTitle()

if target and not target.isRedirect and target ~= redirect then

-- We should actually be calling expandTemplate on the grandparent rather than on the parent, but we can't do that yet

-- Since we don't have grandparent access, though, it means the thing we're calling doesn't either, so it doesn't really matter yet

local parsedTarget = pframe:expandTemplate{title = ':' .. target.prefixedText, args = pframe.args}

if frame.args.showontransclusion and not mw.isSubsting() then

local discussionPage = args[1] and mw.text.trim(args[1])

if not discussionPage or discussionPage == then

discussionPage = redirect

end

return messageOnTransclusions:format(redirect, args.year, args.month, args.day, discussionPage) .. parsedTarget

else

return parsedTarget

end

end

end

-- We're not being transcluded, or we can't figure out how to display our target.

-- Display the RfD banner.

return makeRfdNotice(frame.args) .. '\' .. frame.args.content

end

local substText = "{{safesubst:#invoke:RfD||%s%s|%s%s\"

.. "\|content=\%s\"

.. "\}}"

local dateText = 'month = %B\|day = %e\|year = %Y\|time = %R\|timestamp = %Y%m%d%H%M%S'

-- called during subst when the template is initially placed on the page

function p.main(frame)

local titleText

local pframe = frame:getParent()

local pargs = pframe.args

local Date

if pargs.days then

Date = os.date(dateText, os.time() - 86400*pargs.days)

else

Date = os.date(dateText)

end

local retval = string.format(substText, pargs.FULLPAGENAME or pargs[1] or , pargs.showontransclusion and '|showontransclusion=1' or , Date, pframe:getTitle() == mw.title.getCurrentTitle().prefixedText and '|category=' or , pargs.content or )

if mw.isSubsting() then

return retval

else

return frame:expandTemplate{title = 'Template:Error:must be substituted', args = {'rfd'}} .. frame:preprocess(retval)

end

end

return p

7 : Redirects for discussion from %s %s|All redirects for discussion|Redirects for discussion|All redirects for discussion|Temporary maintenance holdings|RfD errors|RfD errors

随便看

 

开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。

 

Copyright © 2023 OENC.NET All Rights Reserved
京ICP备2021023879号 更新时间:2024/11/10 14:58:38