Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Special pages
WikiChilopoda
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Taxonbar/candidate
Module
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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) == true 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 or unacceptable found } --preliminary exclusion criteria if string.match( currentTitle.text, '^List of ') then return '' end --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] end else return '' end if currentItem then --currentItem should not be nil here, but check just in case --determine if {{Taxonbar}} is *definitely* missing, *possibly* missing, or not missing at all local whitelist = require( 'Module:Taxonbar/whitelist' ).whitelist local blacklist = require( 'Module:Taxonbar/blacklist' ).blacklist local acceptableInstanceOf_All = whitelist{ args = { 'all' } } local unacceptableInstanceOf = blacklist{ args = {} } local acceptableCount = 0 local unacceptableCount = 0 for _, instanceOfState in pairs ( currentItem:getBestStatements('P31') ) do --instance of local instanceOf = instanceOfState.mainsnak.datavalue.value.id if acceptableInstanceOf_All[instanceOf] then acceptableCount = acceptableCount + 1 elseif unacceptableInstanceOf[instanceOf] then unacceptableCount = unacceptableCount + 1 end end for _, subclassOfState in pairs ( currentItem:getBestStatements('P279') ) do --subclass of local subclassOf = subclassOfState.mainsnak.datavalue.value.id if acceptableInstanceOf_All[subclassOf] then acceptableCount = acceptableCount + 1 elseif unacceptableInstanceOf[subclassOf] then unacceptableCount = unacceptableCount + 1 end end if acceptableCount > 0 then categories[1] = '' categories[2] = '[[Category:Taxobox articles missing a taxonbar]]' elseif unacceptableCount > 0 then categories[1] = '' categories[2] = '' end return table.concat(categories) else return '' end end end return p
Summary:
Please note that all contributions to WikiChilopoda 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
Chilopoda Wiki: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/doc
(
edit
)
Search
Search
Editing
Module:Taxonbar/candidate
Add topic