Modul:Taxonbar/candidate
Videz
Predloga se uporablja na 394663 straneh, zato bo vsaka njena sprememba takoj zelo opazna. Prosimo, da vse spremembe, ki jih želite uvesti, pred uvedbo preizkusite na podstraneh predloge (/peskovnik in /testniprimeri) ali na svojih lastnih podstraneh. Pred spreminjanjem te predloge se o želenih spremembah rajši pogovorite na pogovorni strani. |
Uporablja Lua: |
Povezane strani |
---|
About
[uredi kodo]This template is designed to be called from {{Taxobox/core}} or a related template, and tracks pages which may be candidates for a {{Taxonbar}}.
If no {{Taxonbar}} exists on the transcluded page, the page's Wikidata item is checked against this whitelist of acceptable primerek od (P31)s/podpomenka od (P279)s, and this blacklist of unacceptable properties.
If an acceptable instance/subclass is found, then the page is categorized as:
If no acceptables nor unacceptables are found, then it is categorized as:
If no acceptables & at least 1 unacceptable is found, then no categorization is performed.
Usage
[uredi kodo]Associated lists
[uredi kodo]Whitelist
- takson (Q16521)
- monotipski takson (Q310890)
- monotipski fosilni takson (Q47487597)
- ihnotakson (Q2568288)
- fosilni takson (Q23038290)
- ootakson (Q59278506)
- izumrl takson (Q98961713)
- parafiletska skupina (Q58051350)
- križanec (Q42621)
- incertae sedis (Q235536)
- klad (Q713623)
- serotip (Q848328)
- Candidatus (Q857968)
- nerazpoložljiva kombinacija (Q17487588)
- taxon hypothesis (Q124477390)
Zgornja dokumentacija je vključena iz Modul:Taxonbar/candidate/dok. (uredi | zgodovina) Urejevalci lahko preizkušate ta modul v peskovniku (ustvari | mirror) in testnihprimerih (ustvari). Prosimo, da dodate kategorije v /dok podstran. Podstrani te predloge. |
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 = {
'[[Kategorija:Taksonomski članki z verjetno manjkajočim 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] = '[[Kategorija:Taksonomski članki z manjkajočim taxonbar]]'
elseif unacceptableCount > 0 then
categories[1] = ''
categories[2] = ''
end
return table.concat(categories)
else
return ''
end
end
end
return p