Module:Tfd links: Difference between revisions
From Zoophilia Wiki
Jump to navigationJump to search
meta>Pppery ... or not |
meta>Pppery Can someone please close old TfDs before the page becomes so large that I have to hide some of the links? |
||
Line 44: | Line 44: | ||
.. fname, 'limit=5000', 'links') .. sep | .. fname, 'limit=5000', 'links') .. sep | ||
res = res .. fullurllink('Special:Whatlinkshere/' | res = res .. fullurllink('Special:Whatlinkshere/' | ||
.. fname, 'limit=5000&hidelinks=1', 'transclusions') | .. fname, 'limit=5000&hidelinks=1', 'transclusions') | ||
end | end | ||
if thisPage ~= "Wikipedia:Templates for discussion" | if thisPage ~= "Wikipedia:Templates for discussion" | ||
and thisPage ~= "Wikipedia:Templates for discussion/All current discussions" then | and thisPage ~= "Wikipedia:Templates for discussion/All current discussions" then | ||
res = res .. sep .. fullurllink('Special:Log', 'page=' | |||
.. urlencode(fname), 'logs') | |||
res = res .. sep .. '[[Special:PrefixIndex/' .. fname .. '/|subpages]]' | res = res .. sep .. '[[Special:PrefixIndex/' .. fname .. '/|subpages]]' | ||
res = res .. '<span class="sysop-show">' .. sep .. fullurllink(fname, 'action=delete&wpReason=' | res = res .. '<span class="sysop-show">' .. sep .. fullurllink(fname, 'action=delete&wpReason=' |
Revision as of 20:50, 20 April 2019
Documentation for this module may be created at Module:Tfd links/doc
-- This module implements [[Template:Tfd links]]
local p = {}
local function urlencode(text)
-- Return equivalent of {{urlencode:text}}.
local function byte(char)
return string.format('%%%02X', string.byte(char))
end
return text:gsub('[^ %w%-._]', byte):gsub(' ', '+')
end
local function fullurllink(t, a, s)
return '[//en.wikipedia.org/w/index.php?title=' .. urlencode(t) .. '&' .. a .. ' ' .. s .. ']'
end
function p.main(frame)
local args = frame:getParent().args
local ns = ((args['catfd'] and args['catfd'] ~= '') and 'Category')
or ((args['module'] and args['module'] ~= '') and 'Module')
or 'Template'
local tname = mw.getContentLanguage():ucfirst(args['1'] or 'Example')
local fname = ns .. ':' .. tname
local ymd = args['2'] or ''
local fullpagename = (ymd ~= '')
and 'WP:Templates for discussion/Log/' .. ymd
or frame:preprocess('{{FULLPAGENAME}}')
local sep = ' <b>·</b> '
local res = '<span id="' .. ns .. ':' .. tname
.. '" class="plainlinks nourlexpansion 1x">'
.. '[[:' .. ns .. ':' .. tname .. ']] ('
if ymd ~= '' then
local dmy = frame:expandTemplate{ title='date', args={ymd, 'dmy'} }
res = res .. '[[' .. fullpagename .. '#' .. fname
.. '|' .. dmy .. ']]) ('
end
local thisPage = mw.title.getCurrentTitle().prefixedText
res = res .. fullurllink(fname, 'action=edit', 'edit') .. sep
res = res .. '[[' .. ns .. ' talk:' .. tname .. '|talk]]' .. sep
res = res .. fullurllink(fname, 'action=history', 'history')
if ns ~= 'Category' then
res = res .. sep .. fullurllink('Special:Whatlinkshere/'
.. fname, 'limit=5000', 'links') .. sep
res = res .. fullurllink('Special:Whatlinkshere/'
.. fname, 'limit=5000&hidelinks=1', 'transclusions')
end
if thisPage ~= "Wikipedia:Templates for discussion"
and thisPage ~= "Wikipedia:Templates for discussion/All current discussions" then
res = res .. sep .. fullurllink('Special:Log', 'page='
.. urlencode(fname), 'logs')
res = res .. sep .. '[[Special:PrefixIndex/' .. fname .. '/|subpages]]'
res = res .. '<span class="sysop-show">' .. sep .. fullurllink(fname, 'action=delete&wpReason='
.. urlencode('[[' .. fullpagename .. '#' .. fname .. ']]'), 'delete') .. '</span>'
end
res = res .. ')</span>'
return res
end
return p