Module:Redirect and target

Revision as of 17:45, 30 October 2024 by Muskit Gergous (talk | contribs) (Created page with "local getTarget = require('Module:Redirect').getTarget local p = {} function p.line(frame) local pageTitle = frame.args[1] local target = getTarget(pageTitle, true) if target then return string.format('%s%s', pageTitle, target) end return string.format('%s is not a redirect', pageTitle) end function p.report(frame) local pageTitle = frame.args[1] local target = getTarget(pageTitle, true) if target then return string.format('<i>%s (R)</i...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Implements {{redirect and target}}

Usage

{{#invoke:Redirect and target|function_name}}


local getTarget = require('Module:Redirect').getTarget
local p = {}

function p.line(frame)
	local pageTitle = frame.args[1]
	local target = getTarget(pageTitle, true)
	if target then
		return string.format('[[%s]] → [[%s]]', pageTitle, target)
	end
	return string.format('[[%s]] is not a redirect', pageTitle)
end

function p.report(frame)
	local pageTitle = frame.args[1]
	local target = getTarget(pageTitle, true)
	if target then
		return string.format('<i>[[%s]] (R)</i> → [[%s]]', pageTitle, target)
	end
	return string.format('[[%s]]', pageTitle)
end

return p