Open main menu
Home
Random
Donate
Recent changes
Special pages
Community portal
Preferences
About Stockhub
Disclaimers
Search
User menu
Talk
Contributions
Create account
Log in
Editing
Module:Taxonbar/candidate/sandbox
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.check(frame) local taxonbarExists = require('Module:Taxonbar/exists').check if taxonbarExists(frame) then return '' else local resolveEntity = require( 'Module:ResolveEntityId' ) local currentTitle = mw.title.getCurrentTitle() local currentItem = nil local categories = { '[[Category:Taxobox articles possibly missing a taxonbar]]' --unset if acceptable found } --find Wikidata item if currentTitle.namespace == 0 then --mainspace local currentEntityId = mw.wikibase.getEntityIdForCurrentPage() if resolveEntity._id(currentEntityId) then currentItem = mw.wikibase.getEntity(currentEntityId) else --currentEntityId == nil/unresolvable return categories[1]..' here' end else return '' end if currentItem then --currentItem should not be nil here, but check just in case --determine if {{Taxonbar}} is *possibly* missing, or *definitely* missing local acceptableInstanceOf_All = { --copied from [[Module:Taxonbar]] ['Q16521'] = 'taxon', --strict ['Q310890'] = 'monotypic taxon', --strict ['Q2568288'] = 'ichnotaxon', --strict ['Q23038290'] = 'fossil taxon', --strict ['Q47487597'] = 'monotypic fossil taxon', --strict ['Q42621'] = 'hybrid', --lax ['Q235536'] = 'incertae sedis', --lax ['Q713623'] = 'clade', --lax ['Q848328'] = 'serotype', --lax ['Q857968'] = 'candidatus', --lax ['Q17487588'] = 'unavailable combination', --lax } local db = 0 for _, instanceOfState in pairs ( currentItem:getBestStatements('P31') ) do --instance of db = db + 1 local instanceOf = instanceOfState.mainsnak.datavalue.value.id if acceptableInstanceOf_All[instanceOf] then categories[1] = '' categories[2] = '[[Category:Taxobox articles missing a taxonbar]]' break end end return table.concat(categories)..' '..db else return '' end end end return p
Summary:
Please note that all contributions to Stockhub 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
Stockhub:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Template used on this page:
Module:Taxonbar/candidate/sandbox/doc
(
edit
)