Module:Sock list
Appearance
![]() | This module depends on the following other modules: |
Implements {{sock list}}.
Usage
{{#invoke:Sock list|main}}
local p = {}
local getArgs = require('Module:Arguments').getArgs
function p.main(frame)
local args = getArgs(frame)
return p._main(frame, args)
end
function isIpOrRange(s)
local modip = require('Module:IP')
local success, ip = pcall(modip.IPAddress.new, s)
if success then
return 'ip'
end
success, ip = pcall(modip.Subnet.new, s)
if success then
return 'range'
end
return nil
end
function listEntry(frame, sock, master)
local template = isIpOrRange(sock) and "checkip" or "checkuser"
local li = mw.html.create('li')
li:wikitext(frame:expandTemplate{title=template, args={sock, ['master name']=master}})
return li
end
function toolEIA(args)
local span = mw.html.create('span')
span:attr('class', 'plainlinks')
local a = mw.html.create('a')
local url = "https://tools.wmflabs.org/sigma/editorinteract.py?users=" .. args.master
for i, sock in ipairs(args) do
url = url .. "&users" .. mw.uri.encode(sock)
end
a
:attr('href', url)
:wikitext("Editor interaction utility")
span:node(a)
return span
end
function p._main(frame, args)
local ul = mw.html.create('ul')
for i, sock in ipairs(args) do
ul:node(listEntry(frame, sock, args.master))
end
return ul
end
return p