模組:Taxonbar/candidate
可在模組:Taxonbar/candidate/doc建立此模組的說明文件
local p = {}function p.check(frame)local taxonbarExists = require('Module:Taxonbar/exists').checkif taxonbarExists(frame) thenreturn ''elselocal resolveEntity = require( 'Module:ResolveEntityId' )local currentTitle = mw.title.getCurrentTitle()local currentItem = nillocal categories = {'[[Category:Taxobox articles possibly missing a taxonbar]]' --unset if acceptable or unacceptable found}--preliminary exclusion criteriaif string.match( currentTitle.text, '^List of ') thenreturn ''end--find Wikidata itemif currentTitle.namespace == 0 then --mainspacelocal currentEntityId = mw.wikibase.getEntityIdForCurrentPage()if resolveEntity._id(currentEntityId) thencurrentItem = mw.wikibase.getEntity(currentEntityId)else --currentEntityId == nil/unresolvablereturn categories[1]endelsereturn ''endif currentItem then --currentItem should not be nil here, but check just in case--determine if {{Taxonbar}} is *possibly* missing, or *definitely* missinglocal 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 unacceptableInstanceOf = {['Q913170'] = 'trivial name',['Q55983715'] = 'group of organisms known by one particular common name',['Q937228'] = 'property',['Q14712'] = 'drupe',['Q163233'] = 'compound drupe',['Q747463'] = 'compound fruit',}local acceptableCount = 0local unacceptableCount = 0for _, instanceOfState in pairs ( currentItem:getBestStatements('P31') ) do --instance oflocal instanceOf = instanceOfState.mainsnak.datavalue.value.idif acceptableInstanceOf_All[instanceOf] thenacceptableCount = acceptableCount + 1elseif unacceptableInstanceOf[instanceOf] thenunacceptableCount = unacceptableCount + 1endendfor _, subclassOfState in pairs ( currentItem:getBestStatements('P279') ) do --subclass oflocal subclassOf = subclassOfState.mainsnak.datavalue.value.idif acceptableInstanceOf_All[subclassOf] thenacceptableCount = acceptableCount + 1elseif unacceptableInstanceOf[subclassOf] thenunacceptableCount = unacceptableCount + 1endendif acceptableCount > 0 thencategories[1] = ''categories[2] = '[[Category:Taxobox articles missing a taxonbar]]'elseif unacceptableCount > 0 thencategories[1] = ''categories[2] = ''endreturn table.concat(categories)elsereturn ''endendendreturn p
🔥 Top keywords: Tàu HiĕkWikipedia:Duâi chéu â幫助:Mŭk-luŏhDâ̤-nê-ché̤ṳ Sié-gái Dâi-ciéngWikipedia:Guestbook for Non-Min-Dong Speakers討論:Tàu HiĕkWikipedia特殊:最近其改變特殊:我其貢獻Dâng Sìng-gŭng幫助:Mŭk-liŏhWikipedia:Mò̤ hô-cáik sĭng-mìng特殊:我其討論Bàng-uâHậu Giang鄭成功春菜Wikipedia:大𣗬下Éng-dô427 nièngHâ-gié Olympic Ông-dông-huôi640 nièng文件:Summer olympics all cities.PNGĬng-ngṳ̄1200 nièng分類:Dṳ̆ng-huà Ìng-mìng Gê̤ṳng-huò-guókBī-gáu ùng-hŏkPanamaCOVID-19Bā-lāng-gū-tôiÓ̤-ciŭWikimedia CommonsHTMLTanzaniaMāGáu-huòng Pius 12-sié3 nguŏk 8 hô̤Seward Gông (Kansas)Gék-lìng