Editing
Module:Taxonbar/candidate
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.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 MycoTaxa 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
MycoTaxa:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
MycoTaxa entities used in this page
P279
: Miscellaneous (e.g. aliases, entity existence)
P31
: Miscellaneous (e.g. aliases, entity existence)
Q124477390
: Miscellaneous (e.g. aliases, entity existence)
Q14712
: Miscellaneous (e.g. aliases, entity existence)
Q163233
: Miscellaneous (e.g. aliases, entity existence)
Q16521
: Miscellaneous (e.g. aliases, entity existence)
Q17487588
: Miscellaneous (e.g. aliases, entity existence)
Q23038290
: Miscellaneous (e.g. aliases, entity existence)
Q235536
: Miscellaneous (e.g. aliases, entity existence)
Q2568288
: Miscellaneous (e.g. aliases, entity existence)
Q310890
: Miscellaneous (e.g. aliases, entity existence)
Q42621
: Miscellaneous (e.g. aliases, entity existence)
Q47487597
: Miscellaneous (e.g. aliases, entity existence)
Q55983715
: Miscellaneous (e.g. aliases, entity existence)
Q58051350
: Miscellaneous (e.g. aliases, entity existence)
Q59278506
: Miscellaneous (e.g. aliases, entity existence)
Q713623
: Miscellaneous (e.g. aliases, entity existence)
Q747463
: Miscellaneous (e.g. aliases, entity existence)
Q848328
: Miscellaneous (e.g. aliases, entity existence)
Q857968
: Miscellaneous (e.g. aliases, entity existence)
Q913170
: Miscellaneous (e.g. aliases, entity existence)
Q937228
: Miscellaneous (e.g. aliases, entity existence)
Q98961713
: Miscellaneous (e.g. aliases, entity existence)
Templates used on this page:
Template:Category link with count
(
edit
)
Template:Clc
(
edit
)
Template:Column
(
edit
)
Template:Column/styles.css
(
edit
)
Template:Columns-end
(
edit
)
Template:Columns-start
(
edit
)
Template:Documentation subpage
(
edit
)
Template:Endplainlist
(
edit
)
Template:High-use
(
edit
)
Template:Lua
(
edit
)
Template:Lua sidebar
(
edit
)
Template:Lua sidebar/styles.css
(
edit
)
Template:Plainlist
(
edit
)
Template:Plainlist/styles.css
(
edit
)
Template:Q
(
edit
)
Template:Sandbox other
(
edit
)
Template:Sidebar
(
edit
)
Template:Str left
(
edit
)
Template:Taxonbar/blacklist
(
edit
)
Template:Taxonbar/candidate/doc
(
edit
)
Template:Taxonbar/whitelist
(
edit
)
Template:Template link
(
edit
)
Template:Template link expanded
(
edit
)
Template:Tl
(
edit
)
Template:Tlx
(
edit
)
Template:Wdpl
(
edit
)
Template:Wikidata
(
edit
)
Template:Wikidata entity link
(
edit
)
Template:Wikidata property link
(
edit
)
Module:Arguments
(
edit
)
Module:High-use
(
edit
)
Module:List
(
edit
)
Module:Lua banner
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Redirect
(
edit
)
Module:Sidebar
(
edit
)
Module:Sidebar/configuration
(
edit
)
Module:Sidebar/styles.css
(
edit
)
Module:String
(
edit
)
Module:TableTools
(
edit
)
Module:Taxonbar/blacklist
(
edit
)
Module:Taxonbar/candidate/doc
(
edit
)
Module:Taxonbar/whitelist
(
edit
)
Module:Template link general
(
edit
)
Module:Transclusion count
(
edit
)
Module:Transclusion count/data/T
(
edit
)
Module:Wd
(
edit
)
Module:Wd/i18n
(
edit
)
Module:Yesno
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Module
Discussion
English
Views
Read
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information
In other projects