Module:UserLinks: Difference between revisions

m
Changed protection level for "Module:UserLinks": no longer in interface ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite))
m (1 revision imported)
m (Changed protection level for "Module:UserLinks": no longer in interface ([Edit=Require template editor access] (indefinite) [Move=Require template editor access] (indefinite)))
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. --
-- This module was imported from revision 677874163 on the English Wikipedia. --
--------------------------------------------------------------------------------
 
Line 49 ⟶ 48:
-- data snippets. New link functions should be added below the existing
-- functions.
--
-- For documentation on how to add new link functions, please see
-- [[Module:UserLinks#Adding new links]].
----------------------------------------------------------------------------
 
Line 82 ⟶ 78:
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 ⟶ 98:
return makeUrlLink(
{
host = 'toolsxtools.wmflabs.org',
path = '/xtools-ec/',
query = {
userusername = snippets.username,
project = snippets.toolLang .. '.' .. snippets.projectLong .. '.org'
}
Line 116 ⟶ 126:
'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 = {
wikiusername = snippets.projectLongusername,
project = snippets.toolLang .. '.' .. snippets.projectLong .. '.org'
}
},
message('display-autoedits')
)
end
Line 184 ⟶ 209:
return makeUrlLink(
{
host = 'toolsxtools.wmflabs.org',
path = '/xtools/editsummary/index.php',
query = {
nameusername = snippets.username,
langproject = snippets.toolLang, .. '.' .. snippets.projectLong .. '.org'
wiki = snippets.projectLong
}
},
Line 616 ⟶ 640:
 
return snippets
end
 
function p.validateProjectCode(s)
Line 624 ⟶ 648:
-- returns nil for both.
interwikiTable = interwikiTable or mw.loadData('Module:InterwikiTable')
for key, t in pairs(interwikiTable) do
for i, prefix in ipairs(t.iw_prefix) do
if s == prefix then
return s, key
end
end
end
end
return nil, nil
end
 
Line 814 ⟶ 838:
ret[#ret + 1] = '|}'
return table.concat(ret, '\n')
end
 
return p
Anonymous user