Module:UserLinks: Difference between revisions
m
1 revision imported from wikipedia:Module:UserLinks
m (1 revision imported) |
m (1 revision imported from wikipedia:Module:UserLinks) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 3:
-- This module creates a list of links about a given user. It can be used on --
-- its own or from a template. See the /doc page for more documentation. --
--------------------------------------------------------------------------------
Line 49 ⟶ 48:
-- data snippets. New link functions should be added below the existing
-- functions.
----------------------------------------------------------------------------
Line 62 ⟶ 58:
snippets.username
)
end
function linkFunctions.np(snippets)
-- User page (no ping)
return '<span class="plainlinks">' .. makeFullUrlLink(
snippets.interwiki,
2,
snippets.username,
'',
snippets.username
) .. '</span>'
end
Line 82 ⟶ 89:
message('display-contributions')
)
end
function linkFunctions.c64(snippets)
-- Contributions
local first64 = snippets.username:match('^%x+:%x+:%x+:%x+:')
or snippets.username:match('^%x+:%x+:%x+:')
or snippets.username:match('^%x+:%x+:')
or snippets.username:match('^%x+:')
return first64 and makeWikilink(
snippets.interwiki,
-1,
'Contribs/' .. first64 .. ':/64',
'(/64)'
) or ''
end
Line 88 ⟶ 109:
return makeUrlLink(
{
host = '
path = '/
query = {
project = snippets.toolLang .. '.' .. snippets.projectLong .. '.org'
}
Line 116 ⟶ 137:
'Log/' .. snippets.username,
message('display-logs')
)
end
function linkFunctions.ae(snippets)
-- Automated edits (and non-automated contributions).
return makeUrlLink(
{
host = 'xtools.wmflabs.org',
path = '/autoedits/',
query = {
username = snippets.username,
project = snippets.toolLang .. '.' .. snippets.projectLong .. '.org'
}
},
message('display-autoedits')
)
end
Line 184 ⟶ 220:
return makeUrlLink(
{
host = '
path = '
query = {
}
},
Line 316 ⟶ 351:
end
function linkFunctions.nuke(snippets)
-- Mass delete/Special:Nuke
return makeWikilink(
snippets.interwiki,
-1,
'Nuke/' .. snippets.username,
message('display-nuke')
)
end
function linkFunctions.gender(snippets)
-- Gender
return mw.getCurrentFrame():callParserFunction(
'GENDER',
snippets.username,
'he',
'she',
'they'
)
end
----------------------------------------------------------------------------
-- End of link functions
Line 616 ⟶ 672:
return snippets
end
function p.validateProjectCode(s)
Line 624 ⟶ 680:
-- returns nil for both.
interwikiTable = interwikiTable or mw.loadData('Module:InterwikiTable')
end
end
Line 674 ⟶ 730:
local options = {}
options.isDemo = yesno(args.demo) or false
options.noPing = yesno(args.noPing) or yesno(args.noping) or yesno(args.np) or false
options.toolbarStyle = yesno(args.small) and 'font-size: 90%;' or nil
options.sup = yesno(args.sup, true)
Line 699 ⟶ 756:
function p.export(codes, links, options)
-- Make the user link.
local userLink = options.noPing and links.np or links.u
-- If we weren't passed any link codes, just return the user link.
Line 762 ⟶ 819:
return links[code]
end
return p
|