Content deleted Content added
-- backwards compatibility for deprecated _entityid function |
Sync from sandbox, follow Wikipedia redirects. Tag: Reverted |
||
Line 1:
local p = {}
return p._id(id,alt)▼
end▼
function p._id(id,alt)
Line 13 ⟶ 8:
if mw.wikibase.isValidEntityId(id) then
-- id is valid
if id then▼
-- entity exists
return
end
end
else
if
-- entity id is a title that matches a Wikidata entity
local instanceOf = mw.wikibase.getBestStatements(
if (instanceOf and instanceOf.mainsnak.datavalue.value.id ~= 'Q4167410') or (instanceOf == nil and mw.wikibase.entityExists(eid)) then
-- not disambiguation, or exists but is missing an instance-of value
--
return
else
-- title is neither disambiguation or redirect
return mw.wikibase.getEntityIdForTitle(mw.wikibase.getSitelink(eid))
end
▲ end
else
-- no wikidata item exists
local rtarget = mw.title.new(id).redirectTarget
-- title is a Wikipedia redirect
end
end
|