Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Documentation for this module may be created at Module:No ping/doc

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 label = args['label' .. tostring(i)]
		local url = ""
		local targetUser = username
		if (username:sub(1, (mw.site.namespaces.User.name .. ':'):len()) == (mw.site.namespaces.User.name .. ':')) then
			targetUser = username:sub((mw.site.namespaces.User.name .. ':'):len() + 1)
		end
		if targetUser:sub(1, 2) == '~2' then
			-- Temporary user target; use internal contributions link
			url = mw.site.namespaces.Special.name .. ':Contributions/' .. targetUser
			url = format('[[%s|%s]]', url, label or username)
		else
			-- Named user target; use external link
			url = fullUrl(mw.site.namespaces.User.name .. ':' .. targetUser)
			url = tostring(url)
			url = format('[%s %s]', url, label or username)
		end
		ret[#ret + 1] = url
	end
	ret = mw.text.listToText(ret)
	ret = '<span class="plainlinks">' .. ret .. '</span>'
	return ret
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.