Editing Module:TfdLinks

From MINR.ORG WIKI

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 10: Line 10:
 
end
 
end
  
local function fullurllink(t, a, s)
+
local function fullurl(t, a)
return '[//en.wikipedia.org/w/index.php?title=' .. urlencode(t) .. '&' .. a .. ' ' .. s .. ']'
+
return '//en.wikipedia.org/w/index.php?title=' + t + '&' + a
 
end
 
end
  
 
function p.main(frame)
 
function p.main(frame)
local args = frame:getParent().args
+
local args = frame.getParent().args
local ns = ((args['catfd'] and args['catfd'] ~= '') and 'Category')
+
local ns = (args['catfd'] and args['catfd'] ~= '') and 'Category' or 'Template'
or ((args['module'] and args['module'] ~= '') and 'Module')
 
or 'Template'
 
 
local tname = mw.getContentLanguage():ucfirst(args['1'] or 'Example')
 
local tname = mw.getContentLanguage():ucfirst(args['1'] or 'Example')
local fname = ns .. ':' .. tname
+
local fname = ns + ':' + tname
 
local ymd = args['2'] or ''
 
local ymd = args['2'] or ''
 
local fullpagename = (ymd ~= '')
 
local fullpagename = (ymd ~= '')
and 'WP:Templates for discussion/Log/' .. ymd
+
and 'WP:Templates for discussion/Log' + ymd
 
or frame:preprocess('{{FULLPAGENAME}}')
 
or frame:preprocess('{{FULLPAGENAME}}')
 
local sep = '&nbsp;<b>·</b> '
 
local sep = '&nbsp;<b>·</b> '
 
 
local res = '<span id="' .. ns .. ':' .. tname  
+
local res = '<span id="' + ns + ':' + tname  
.. '" class="plainlinks nourlexpansion 1x">'
+
+ '" class="plainlinks nourlexpansion 1x">'
.. '[[:' .. ns .. ':' .. tname .. ']]&nbsp;('
+
+ '[[:' + ns + ':' + tname + ']]&nbsp;('
 
 
 
if ymd ~= '' then
 
if ymd ~= '' then
local dmy = frame:expandTemplate{ title='date', args={ymd, 'dmy'} }  
+
local dmy = frame:expandTemplate{ title = 'date', args = {args['2'], 'dmy'} }  
res = res .. '[[' .. fullpagename .. '#' .. fname  
+
res = res + '[[' + fullpagename + '#' + fname + '|' + dmy + ') ('
.. '|' .. dmy .. ']]) ('
 
 
end
 
end
res = res .. fullurllink(fname, 'action=edit', 'edit') .. sep
+
res = res + '[' + fullurl(fname, 'action=edit') + ' edit]' + sep
res = res .. '[[' .. ns .. ' talk:' .. tname .. '|talk]]' .. sep
+
res = res + '[[' + ns + ' talk:' + tname + '|talk]]' + sep
res = res .. fullurllink(fname, 'action=history', 'history') .. sep
+
res = res + '[' + fullurl(fname, 'action=history') + ' history' + sep
 
if ns ~= 'Category' then
 
if ns ~= 'Category' then
res = res .. fullurllink('Special:Whatlinkshere/'  
+
res = res + '[' + fullurl('Special:Whatlinkshere/' + fname, 'limit=999') + ' links]' + sep
.. fname, 'limit=999', 'links') .. sep
 
 
end
 
end
res = res .. fullurllink('Special:Log', 'page='  
+
res = res + '[' + fullurl('Special:Log', 'page=' + urlencode(fname)) + ' logs]' + sep
.. urlencode(fname), 'logs') .. sep
+
res = res + '[[Special:PrefixIndex/' + fname + '|subpages]]' + sep
res = res .. '[[Special:PrefixIndex/' .. fname .. '/|subpages]]'
+
res = res + '[' + fullurl(fname, 'action=delete&wpReason=' + urlencode('[[' + fullpagename + '#' + fname + ']]')) + ' delete]'
res = res .. '<span class="sysop-show">' .. sep .. fullurllink(fname, 'action=delete&wpReason='  
+
res = res + ')</span>'
.. urlencode('[[' .. fullpagename .. '#' .. fname .. ']]'), 'delete') .. '</span>'
 
res = res .. ')</span>'
 
 
 
 
return res
 
return res

Please note that all contributions to MINR.ORG WIKI may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see MINR.ORG WIKI:Copyrights for details). Do not submit copyrighted work without permission!

Cancel Editing help (opens in new window)