View source for Module:ResolveEntityId
Jump to navigation
Jump to search
You do not have permission to edit this page, for the following reasons:
You can view and copy the source of this page.
local p = {}
function p._id(idOrTitle, alt)
local function checkId(id)
if id and mw.wikibase.entityExists(id) then
local sitelink = mw.wikibase.getSitelink(id)
if sitelink then
return mw.wikibase.getEntityIdForTitle(sitelink) or mw.wikibase.getEntity(id).id
end
return mw.wikibase.getEntity(id).id
else
return alt
end
end
if type(idOrTitle) == 'string' then
idOrTitle = mw.ustring.upper(mw.ustring.sub(idOrTitle, 1, 1)) .. mw.ustring.sub(idOrTitle, 2)
if mw.wikibase.isValidEntityId(idOrTitle) then
-- idOrTitle is in the proper format for a Wikidata entity ID
return checkId(idOrTitle)
else
local eid = mw.wikibase.getEntityIdForTitle(idOrTitle)
000
1:0
Template used on this page:
Return to Module:ResolveEntityId.