Editing
Module
:
ResolveEntityId
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {} function p._entityid(_,id,alt) -- backwards compatibility for deprecated _entityid function return p._id(id,alt) end function p._id(id,alt) if type(id) == 'string' then id = mw.ustring.upper(mw.ustring.sub(id,1,1))..mw.ustring.sub(id,2) if mw.ustring.match(id,'^Q%d+$') then -- id is in the proper format for a Wikidata entity if mw.wikibase.isValidEntityId(id) then -- id is valid id = mw.wikibase.getEntity(id) if id then -- entity exists return id.id end end else id = mw.wikibase.getEntityIdForTitle(id) if id then -- id is a title that matches a Wikidata entity local instanceOf = mw.wikibase.getBestStatements(id, 'P31')[1] --instance of if instanceOf and instanceOf.mainsnak.datavalue.value.id ~= 'Q4167410' then -- not disambiguation return mw.wikibase.getEntity(id).id elseif instanceOf == nil then -- id is a title, but is missing an instance-of value return mw.wikibase.getEntity(id).id end end end end return alt or nil end function p.entityid(frame) return p._id(frame.args[1], frame.args[2]) end return p
Summary:
Please note that all contributions to Zoophilia wiki are considered to be released under the GNU Free Documentation License 1.3 or later (see
Project:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Page included on this page:
Module:ResolveEntityId/doc
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
associated-pages
Module
Discussion
English
Views
Read
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Tools
What links here
Related changes
Page information