Module:No ping: Difference between revisions
Jump to navigation
Jump to search
m>Mr. Stradivarius m Protected Module:No ping: High-risk Lua module ([Edit=Allow only template editors and admins] (indefinite) [Move=Allow only template editors and admins] (indefinite)) |
m>TheDJ let's prepare this for 'global' usage. avoid having to correct it in the future |
||
Line 13: | Line 13: | ||
local format = string.format | local format = string.format | ||
for i, username in ipairs(args) do | for i, username in ipairs(args) do | ||
local url = fullUrl(' | local url = fullUrl(mw.site.namespaces.User.name .. ':' .. username) | ||
url = tostring(url) | url = tostring(url) | ||
local label = args['label' .. tostring(i)] | local label = args['label' .. tostring(i)] |
Revision as of 09:58, 14 April 2014
Documentation for this module may be created at Module:No ping/doc
-- This module implements {{noping}}.
local p = {}
function p.main(frame)
local args = frame:getParent().args
return p._main(args)
end
function p._main(args)
local ret = {}
local fullUrl = mw.uri.fullUrl
local format = string.format
for i, username in ipairs(args) do
local url = fullUrl(mw.site.namespaces.User.name .. ':' .. username)
url = tostring(url)
local label = args['label' .. tostring(i)]
url = format('[%s %s]', url, label or username)
ret[#ret + 1] = url
end
ret = mw.text.listToText(ret)
ret = '<span class="plainlinks">' .. ret .. '</span>'
return ret
end
return p