Content deleted Content added
Fix handling of missing sitelink in code introduced by User:Snævar |
add check that page is valid |
||
(11 intermediate revisions by 3 users not shown) | |||
Line 1:
local p = {}
function p._id(
local function
if
if sitelink then
return mw.wikibase.getEntityIdForTitle(sitelink) or mw.wikibase.getEntity(id).id
end▼
else
return
end
end
if type(
if mw.
--
return checkId(idOrTitle)
▲ if mw.wikibase.entityExists(id) then
end▼
▲ end
else
local eid = mw.wikibase.getEntityIdForTitle(
if eid then
--
local instanceOf = mw.wikibase.getBestStatements(eid, 'P31')[1] --instance of
if
--
return p._id(rtarget.fullText,alt)▼
end
else
-- idOrTitle is a title, but no wikidata item exists for that title
local
if
local rtarget = page.redirectTarget
▲ return p._id(rtarget.fullText, alt)
▲ end
end
end
end
end
return alt
end
|