Open main menu
Home
Random
Recent changes
Special pages
Community portal
Settings
About Porn Base Central
Disclaimers
Porn Base Central
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:ResolveEntityId
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 PornBaseData 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 PornBaseData entity local instanceOf = mw.wikibase.getBestStatements(id, 'P1')[1] --instance of if instanceOf and instanceOf.mainsnak.datavalue.value.id ~= 'Q220' 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 Porn Base Central may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, 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 (see
Porn Base Central:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Preview page with this template
Template used on this page:
Module:ResolveEntityId/doc
(
view source
)