Edge Rewrite
// HTMLRewriter · presentation

This page was redesigned at the edge.

Cloudflare fetched the original article and streamed it through HTMLRewriter to apply an entirely new visual system without rebuilding the source page.

Jump to content

Module:Redirect-distinguish-for

From Wikipedia, the free encyclopedia

mArguments = require('Module:Arguments')
mRedirectHatnote = require("Module:Redirect hatnote")

local p = {}

function p.redirectDistinguishFor(frame)
	local args = mArguments.getArgs(frame, {parentOnly = true})
	local maxArg = 0
	for k, v in pairs(args) do
		if type(k) == 'number' and k > maxArg then maxArg = k end
	end
	local parsedArgs = {}
	for i = 1, maxArg do
		if i ~= 2 then
			parsedArgs[i == 1 and 1 or i - 1] = args[i] end
	end
	return (string.gsub( --Note that the outer parentheses are necessary!
		mRedirectHatnote._redirect(parsedArgs, 1, {selfref = args.selfref}),
		"(redirects? here.)",
		"%1 Not to be confused with [[:" .. (args[2]:match('^:?(.*)')) .. "]].",
		1
	))
end

return p