Module:Resolve

From Bonkipedia
Revision as of 18:20, 12 November 2022 by ManfredoDo (talk | contribs) (1 revision imported: Module Import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

-- 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
}