Content deleted Content added
merge changes from sandbox. simplifies standard transclusion message and adds a `tiny` variant |
NOINDEX only if actually displaying the RfD notice |
||
(16 intermediate revisions by 10 users not shown) | |||
Line 1:
require('
local p = {}
Line 8:
local mboxText = "'''The 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 [[Wikipedia:Deletion policy|deletion policy]].''' <br />"
.. " Please share your thoughts on the matter at '''[[Wikipedia:Redirects for discussion/Log/%s %s %s#%s|this redirect's entry]]''' on the [[Wikipedia:Redirects for discussion|
.. " '''Click on the link below''' to go to the current destination page.<br />"
.. "<small>Please notify the good-faith creator and any main contributors of the redirect by placing <code>{{[[Wikipedia:Substitution|subst]]:[[Template:Rfd notice|Rfd notice]]|%s}} ~~~~</code> on their talk page.</small>__EXPECTUNUSEDTEMPLATE__"
local deleteReason = '[[Wikipedia:Redirects for discussion]] debate closed as delete'
local messageOnTransclusionsStandard = '
.. '
local messageOnTransclusionsTiny
▲ .. ' to help reach a consensus.›</div >'
local function makeTransclusionTag(args, redirect)
local messageOnTransclusionsTiny = ' <span class="boilerplate metadata plainlinks" id="rfd-t" style="'▼
if not discussionPage or discussionPage == '' then
▲ .. '‹[[Wikipedia:Redirects for discussion/Log/%s %s %s#%s|See RfD]]›</span> '
local visClasses = {
['autoconfirmed']='autoconfirmed-show',
['extendedconfirmed']='extendedconfirmed-show sysop-show'
} -- More can be added if justified by situation
local sizeAttrs = {
['standard'] = {
['tags'] = {'<div ', '</div>'},
['style'] = ' border-bottom: 1px solid #AAAAAA;',
},
['tiny'] = {
['tags'] = {'<span ', '</span> '},
['style'] = '',
},
}
local size = sizeAttrs[args.showontransclusion] and args.showontransclusion or 'standard'
local tags = sizeAttrs[size]['tags']
local visibility = visClasses[args.transclusiontagvisibility] or ''
▲ local
local id = 'id="rfd-t" '
local style = 'style="font-size: 85%; text-align: left;' .. sizeAttrs[size]['style'] .. '" '
return tags[1] .. classes .. id .. style .. '>' .. sizeAttrs[size]['message'] .. tags[2]
local function makeRfdNotice(args)
local currentTitle = mw.title.getCurrentTitle()
Line 43 ⟶ 70:
category = string.format('[[Category:Redirects for discussion|%s]][[Category:All redirects for discussion|%s]]', currentTitle.text, currentTitle.text)
end
if category then category = category..'[[Category:Temporary maintenance holdings/RFD]]' end
local noindex = mw.getCurrentFrame():expandTemplate{title="NOINDEX"}
return string.format('%s%s<span id="delete-reason" style="display: none;">%s</span>%s%s',
noindex,
messageBox.main('mbox', {
type = 'delete',
Line 74 ⟶ 103:
-- 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}
showontransclusion = require('Module:Yesno')(showontransclusion, showontransclusion)
▲ local discussionPage = args[1] and mw.text.trim(args[1])
return makeTransclusionTag(args, redirect) .. parsedTarget
▲ discussionPage = redirect
▲ end
▲ return messageOnTransclusionsTiny:format(args.year, args.month, args.day, discussionPage) .. parsedTarget
▲ return messageOnTransclusionsStandard:format(redirect, args.year, args.month, args.day, discussionPage) .. parsedTarget
▲ end
return parsedTarget▼
end
end
end
Line 95 ⟶ 117:
local redirbox
if target then -- target isn't nil
local firstChar = string.sub(target, 1, 1)
if firstChar ~= ":" then
target = ":" .. target
end
redirbox = messageBox.main('mbox', {
type = 'notice',
name = 'RedirectBox',
image = '[[File:Symbol redirect blue.svg|40px]]',
text = "'''This title is currently a redirect ''' to [[
})
else
Line 114 ⟶ 140:
local substText = "{{<includeonly>safesubst:</includeonly>#invoke:RfD||%s%s|%s%s\n"
.. "<!-- The above content is generated by {{subst:
.. "<!-- Don't add anything after this line unless you're drafting a disambiguation page or article to replace the redirect. -->\n}}"
local dateText = 'month = %B\n|day = %e\n|year = %Y\n|time = %R\n|timestamp = %Y%m%d%H%M%S'
Line 120 ⟶ 146:
-- called during subst when the template is initially placed on the page
function p.main(frame)
local pframe = frame:getParent()
local pargs = pframe.args
|