Module:Resolve: Difference between revisions
From Bonkipedia
[[mw:]]>Krinkle (Created page with "-- 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 }") |
ManfredoDo (talk | contribs) m (1 revision imported: Module Import) |
(No difference)
|
Latest revision as of 18:20, 12 November 2022
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
}