Module:Userlinks: Difference between revisions
From Test Wiki
Content deleted Content added
m 1 revision imported |
Block>ST47 Allow linking to contribs of a /64 for IPv6 addresses |
||
| Line 48: | Line 48: | ||
-- data snippets. New link functions should be added below the existing |
-- data snippets. New link functions should be added below the existing |
||
-- functions. |
-- functions. |
||
-- |
|||
-- For documentation on how to add new link functions, please see |
|||
-- [[Module:UserLinks#Adding new links]]. |
|||
---------------------------------------------------------------------------- |
---------------------------------------------------------------------------- |
||
| Line 80: | Line 77: | ||
'Contribs/' .. snippets.username, |
'Contribs/' .. snippets.username, |
||
message('display-contributions') |
message('display-contributions') |
||
) |
|||
end |
|||
function linkFunctions.c64(snippets) |
|||
-- Contributions |
|||
return makeWikilink( |
|||
snippets.interwiki, |
|||
-1, |
|||
'Contribs/' .. snippets.username .. '/64', |
|||
'(/64)' |
|||
) |
) |
||
end |
end |
||
| Line 87: | Line 94: | ||
return makeUrlLink( |
return makeUrlLink( |
||
{ |
{ |
||
host = ' |
host = 'xtools.wmflabs.org', |
||
path = '/ |
path = '/ec/', |
||
query = { |
query = { |
||
username = snippets.username, |
|||
project = snippets.toolLang .. '.' .. snippets.projectLong .. '.org' |
project = snippets.toolLang .. '.' .. snippets.projectLong .. '.org' |
||
} |
} |
||
| Line 115: | Line 122: | ||
'Log/' .. snippets.username, |
'Log/' .. snippets.username, |
||
message('display-logs') |
message('display-logs') |
||
) |
|||
end |
|||
function linkFunctions.ae(snippets) |
|||
-- Automated edits (and non-automated contributions). |
|||
return makeUrlLink( |
|||
{ |
|||
host = 'xtools.wmflabs.org', |
|||
path = '/autoedits/', |
|||
query = { |
|||
| ⚫ | |||
project = snippets.toolLang .. '.' .. snippets.projectLong .. '.org' |
|||
} |
|||
}, |
|||
message('display-autoedits') |
|||
) |
) |
||
end |
end |
||
| Line 183: | Line 205: | ||
return makeUrlLink( |
return makeUrlLink( |
||
{ |
{ |
||
host = ' |
host = 'xtools.wmflabs.org', |
||
path = ' |
path = '/editsummary/', |
||
query = { |
query = { |
||
username = snippets.username, |
|||
project = snippets.toolLang .. '.' .. snippets.projectLong .. '.org' |
|||
| ⚫ | |||
} |
} |
||
}, |
}, |
||
| Line 615: | Line 636: | ||
return snippets |
return snippets |
||
end |
end |
||
function p.validateProjectCode(s) |
function p.validateProjectCode(s) |
||
| Line 623: | Line 644: | ||
-- returns nil for both. |
-- returns nil for both. |
||
interwikiTable = interwikiTable or mw.loadData('Module:InterwikiTable') |
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 |
end |
||
| Line 813: | Line 834: | ||
ret[#ret + 1] = '|}' |
ret[#ret + 1] = '|}' |
||
return table.concat(ret, '\n') |
return table.concat(ret, '\n') |
||
end |
end |
||
return p |
return p |
||