Module:Resolve

Module documentation
-- Test:
-- mw.log(p._resolve('Sandbox')) -> "Project:Sandbox"
-- mw.log(p._resolve(':how___to_contribute')) -> "How to contribute"
local function resolve(titletext)
	local title = mw.title.new(titletext)
	if not title then
		return ''
	end
	local target = title.redirectTarget
	if target then
		title = target
	end
	return title.prefixedText
end

return {
	_resolve = resolve,
	resolve = function(frame)
		return resolve(frame.args.title)
	end
}