Module:No ping: Difference between revisions
Appearance
w>Chaotic Enby implement detection of argument starting with "User:", cf. talk page, sandbox and testcases. feel free to revert me/ask for a self-revert if there is any issue with this. |
m 1 revision imported |
(No difference)
| |
Latest revision as of 01:06, 15 November 2025
Documentation for this module may be created at Module:No ping/doc
-- This module implements {{no ping}}.
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 = ""
if (username:sub(1, (mw.site.namespaces.User.name .. ':'):len()) == (mw.site.namespaces.User.name .. ':')) then
url = fullUrl(username)
else
url = fullUrl(mw.site.namespaces.User.name .. ':' .. username)
end
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