Module:Redirect target

From Pittsburgh Streets

Documentation for this module may be created at Module:Redirect target/doc

local p = {};

function p.redirectTarget(frame)
  -- Arguments passed to the parent template.
  local parent_args = frame:getParent().args;

  local redirect_title = parent_args[1]
  if not redirect_title then
    return '';
  end

  local target = mw.title.new(redirect_title, '').redirectTarget
  if target then
    return target.prefixedText
  else
    return '';
  end
end

return p;