Module:Redirect

--- Generates links based off a redirect. -- This is particularly useful for making "subpage" redirects. -- @module	redirect --	@alias	p -- @author	The JoTS --

local p = {}

function p.link(frame) local redirect = frame.args[1] local subpagePath = frame.args[2] local linkText = frame.args[3] or '' local rTitle = mw.title.new(redirect) if rTitle.isRedirect then local target = rTitle:getContent:match("%b[]"):sub(3,-3) return frame:preprocess(			table.concat{"' or '', linkText,			""}		) else error "Redirect page provided is not a valid redirect" end end