Content deleted Content added
m sync |
remove the getTitle function, as it is no longer necessary after changes to mw.title inside Scribunto; and use more standard _main and _isRedirect and deprecate luaMain and luaIsRedirect |
||
Line 2:
local p = {}
-- Gets the name of a page that a redirect leads to, or nil if it isn't a
Line 33 ⟶ 22:
local titleObj
if type(page) == 'string' or type(page) == 'number' then
titleObj =
elseif type(page) == 'table' and type(page.getContent) == 'function' then
titleObj = page
Line 50 ⟶ 39:
local target = p.getTargetFromText(titleObj:getContent() or "")
if target then
local targetTitle =
if targetTitle then
return targetTitle.prefixedText
Line 75 ⟶ 64:
-- target cannot be determined for some reason.
--]]
function p.
if type(rname) ~= "string" or not rname:find("%S") then
return nil
Line 83 ⟶ 72:
local target = p.getTarget(rname)
local ret = target or rname
ret =
if ret then
ret = ret.prefixedText
Line 99 ⟶ 88:
-- Returns true if the specified page is a redirect, and false otherwise.
function p.
local titleObj =
if not titleObj then
return false
Line 121 ⟶ 110:
end
end
-- Aliases for deprecated function names; needed for backwards compatibility
p.luaMain = p._main
p.luaIsRedirect = p._isRedirect
return p
|