« Module:User-multi » : différence entre les versions
Aucun résumé des modifications |
Aucun résumé des modifications |
||
Ligne 41 : | Ligne 41 : | ||
fun = lookup[code] | fun = lookup[code] | ||
if not fun then | if not fun then | ||
return '<Error> paramètre '..i..' non reconnu' | return '<Error> paramètre '..i..'"'..code..'" non reconnu' | ||
end | end | ||
table.insert( user_links, fun(user) ) | table.insert( user_links, fun(user) ) |
Dernière version du 27 décembre 2021 à 23:50
Ce module génère le rendu du module {{User-multi}}.
local p = {}
lookup = {
['e'] = function(user) return '[[Special:Emailuser/'..user..'|courriel]]' end,
['tl'] = function(user) return '['..tostring(mw.uri.fullUrl('Special:Log','page=Utilisateur:'..user))..' target logs]' end,
['bl'] = function(user) return '['..tostring(mw.uri.fullUrl('Special:Log/block','page=Utilisateur:'..user))..' journal des blocages]' end,
['d'] = function(user) return '[[User talk:'..user..'|discussion]]' end,
['c'] = function(user) return '[[:Special:Contributions/'..user..'|contributions]]' end,
['ct'] = function(user) return '{{Compteur d\'éditions|'..user..'|compteur}}' end,
['m'] = function(user) return '[[Special:Log/move/'..user..'|renommages]]' end,
['l'] = function(user) return '[[Special:Log/'..user..'|actions]]' end,
['bls'] = function(user) return '[[Special:Log/block/'..user..'|blocages]]' end,
['bu'] = function(user) return '[[Special:Block/'..user..'|bloquer]]' end,
['dc'] = function(user) return '[[Special:DeletedContributions/'..user..'|contributions supprimées]]' end,
['del'] = function(user) return '[[Special:Log/delete/'..user..'|suppressions]]' end,
['pr'] = function(user) return '[[Special:Log/protect/'..user..'|protections]]' end,
['rl'] = function(user) return '[[Special:Log/rights/'..user..'|droits]]' end,
['aa'] = function(user) return 'ancien admin : [[Special:Log/block/'..user..'|blocages]]' end,
['ab'] = function(user) return 'ancien bureaucrate : [[Special:Log/rights/'..user..'|droits]]' end,
['lrl'] = function(user) return '['..tostring(mw.uri.fullUrl('Special:Log/rights','page=User:'..user))..' <span style="color:002bb8">droits locaux</span>]' end,
['d-'] = function(user) return '[[:User talk:'..user..'|<abbr class="abbr" title="page de discussion du compte '..user..'">d</abbr>]]' end,
['c-'] = function(user) return '[[:Special:Contributions/'..user..'|<abbr class="abbr" title="contributions du compte '..user..'">c</abbr>]]' end,
['bl-'] = function(user) return '['..tostring(mw.uri.fullUrl('Special:Log/block','page=Utilisateur:'..user))..' <abbr class="abbr" title="blocages du compte '..user..'">b</abbr>]' end
}
function p._build(args)
local user = args['utilisateur']
if not user then
return '<Error> paramètre utilisateur non renseigné'
end
separator = args['séparateur'] or '·'
user_links = {}
for i = 1, 10 do
code = args[i]
if not code then
break
end
fun = lookup[code]
if not fun then
return '<Error> paramètre '..i..'"'..code..'" non reconnu'
end
table.insert( user_links, fun(user) )
end
user_links = table.concat( user_links, ' '..separator..' ' )
return '[[:User:'..user..'|'..user..']] ('..user_links..')'
end
function p.build(frame)
local args = {}
args = frame.args
-- Paramètres vides interprétés par Lua.
local argsParent = frame:getParent().args
for cle, val in pairs(argsParent) do
if val ~= '' then
args[cle] = val
end
end
for i, val in ipairs(argsParent) do
if val ~= '' then
args[i] = val
end
end
return p._build(args)
end
return p