پودمان:Taxonbar
پرونده:Ambox warning blue construction | این پودمان پیش از آلفا ارزیابی شدهاست. این پودمان هنوز تمام نشدهاست و ممکن است در توسعهٔ فعال باشد یا نباشد. نباید از این پودمان در فضای نام مقاله استفاده کرد. پودمانها pre-alpha میمانند تا ویراستار اصلی راضی از ساختار پایهای پودمان باشد. |
This module contains the code of {{Taxonbar}}. To use Taxonbar, follow instructions at الگو:Taxonbar/توضیحات.
پیکربندی[ویرایش]
Parameters and databases are set by پودمان:Taxonbar/conf.
استفاده[ویرایش]
{{#invoke:Taxonbar|function_name}}
At this time we request this module/template not be implemented on taxon pages until links are cleaned up and the module fulfills the needs of the community. Parameters will be added with time in Module:Taxonbar/conf. The goal is to eventually update and implement this Lua code to replace the existing {{Taxonbar}} template.
For testcases use: {{Taxonbar/sandbox2 | from=QID}}
View testcases at الگو:Taxonbar/testcases2
Taxon Example:[ویرایش]
{{Taxonbar/sandbox2 | from=Q243761}}
Result: خطای لوآ در خط 83: attempt to index field 'wikibase' (a nil value).
Testcases[ویرایش]
حافظهٔ نهان سرور را پاکسازی کنیدRhododendron maximum خطای لوآ در خط 83: attempt to index field 'wikibase' (a nil value). Asclepias syriaca خطای لوآ در خط 83: attempt to index field 'wikibase' (a nil value). هلو (Prunus persica) خطای لوآ در خط 83: attempt to index field 'wikibase' (a nil value). شیر کوهی (سرده) خطای لوآ در خط 83: attempt to index field 'wikibase' (a nil value). سگ (Canis lupus familiaris) خطای لوآ در خط 83: attempt to index field 'wikibase' (a nil value). کبودمرغ شرقی (Sialia sialis) خطای لوآ در خط 83: attempt to index field 'wikibase' (a nil value). زنبور عسل (Apis) خطای لوآ در خط 83: attempt to index field 'wikibase' (a nil value). زنبور عسل اروپایی (Apis mellifera) خطای لوآ در خط 83: attempt to index field 'wikibase' (a nil value). Clipper butterfly (Parthenos sylvia) خطای لوآ در خط 83: attempt to index field 'wikibase' (a nil value). Turkey tail (ورسیکالر) خطای لوآ در خط 83: attempt to index field 'wikibase' (a nil value). Button/portobello mushroom (Agaricus bisporus) خطای لوآ در خط 83: attempt to index field 'wikibase' (a nil value).
Wikidata taxon identifiers[ویرایش]
Parameter | Database | Property ID |
---|---|---|
APDB | APDB | p2036 |
AlgeaBase | AlgaeBase | p1348 |
Araneae | Araneae | p2594 |
ARKive | ARKive | p2833 |
Avibase | Avibase | p2026 |
BacDive | BacDive | p2946 |
BHL | BHL | p287 |
BioLib | BioLib | p838 |
BugGuide | BugGuide | p2464 |
ButMoth | ButMoth | p3060 |
Conifers | Conifers.org | 1940 |
eBird | eBird | p3444 |
EoL | EoL | p830 |
EPPO | EPPO | p3031 |
FaunaEuropaea | Fauna Europaea | p1895 |
FishBase | پایگاه داده ماهی | p938 |
FloraBase | FloraBase | p3101 |
Fossilworks | Fossilworks | p842 |
FNA | FNA | p1727 |
FoAO | FoAO | p3100 |
FoC | FoC | p1747 |
Fungorum | Fungorum | p1391 |
GBIF | GBIF | p846 |
GrassBase | GrassBase | p1832 |
GRIN | GRIN | p1421 |
IBC | IBC | p3099 |
ICTV | ICTV | p1076 |
iNaturalist | iNaturalist | p3151 |
IPNI | IPNI | p961 |
IPNI2 | IPNI author | p586 |
ITIS | ITIS | p815 |
IUCN | IUCN | p227 |
LepIndex | LepIndex | p3064 |
LPSN | LPSN | p1991 |
MSW | MSW | p956 |
MycoBank | MycoBank | p962 |
NBN | NBN | p3240 |
NCBI | NCBI | p685 |
Panartic | Panartic Flora | p2434 |
Plantarium | Plantarium | p3102 |
PlantList | Plant List | p1070 |
PLANTS | PLANTS | p1772 |
Plazi | Plazi | p1992 |
Species+ | Species+ | p2040 |
SPRAT | SPRAT | p2455 |
Tropicos | Tropicos | p960 |
USDAPLANTS | PLANTS | p1772 |
VASCAN | VASCAN | p1745 |
Watson | Watson & Dallwitz | p1761 |
WCSP | WCSP | p3591 |
WoRMS | WoRMS | p850 |
WSC | WSC | p3288 |
Xeno-canto | Xeno-canto | p2426 |
ZooBank | ZooBank | p1746 |
Parameter | Database | Property URL/Interwiki link |
---|---|---|
eMonocot | eMonocot | http://e-monocot.org/taxon/urn:kew.org:wcs:taxon:$1 |
emonocotfamily | eMonocot | http://e-monocot.org/taxon/urn:kew.org:wcs:family:$1 |
uBio | uBio | http://www.ubio.org/browser/details.php?namebankID=$1 |
WSC species | World Spider Catalog | http://www.wsc.nmbe.ch/search?sFamily=&fMt=begin&sGenus=&gMt=begin&sSpecies=&sMt=begin&mMt=exact&multiPurpose=slsid&sMulti=$1 |
WSC genus | World Spider Catalog | http://www.wsc.nmbe.ch/search?sFamily=&fMt=begin&sGenus=&gMt=begin&sSpecies=&sMt=begin&mMt=exact&multiPurpose=glsid&sMulti=$1 |
WSC family | World Spider Catalog | http://www.wsc.nmbe.ch/search?sFamily=&fMt=begin&sGenus=&gMt=begin&sSpecies=&sMt=begin&mMt=exact&multiPurpose=flsid&sMulti=$1 |
Wikispecies | ویکیگونه | Wikispecies:$1 |
Module editing — to-do list[ویرایش]
- Improve documentation
Add parameters to remove individual identifiers from taxonbar. This could help the box from becoming two lines when one line is desired.Can be suppressed by setting equal tono
(e.g.|eol=no
). Should we suppress if set to blank (e.g.|eol=
)?Pull the formatter URLs from Wikidata.Add ability to add identifiers not listed on Wikidata.Add support forfrom=
to show taxonbox as an example on pages without data, such as template documentation and userpages.Hide taxonbar if empty.Add support for parameters currently supported by {{Taxonbar}}.Someone want to double-check Module:Taxonbar/conf that we got them all?- See {{Taxonbar/testcases}}.
Add support for entering missing data with listed parameters above.Add documentation.Add support forAdd documentation.wcsp=
Add support forAdd documentation?namebank=
aka uBioAdd support forAdd documentation.emonocot=
- Add support for
others=
? - Disable certain non research-grade databases by default? EOL?
Add support for grin andAdd documentation that a URL must be entered for GRIN rather than ID.grinurl=
- See {{Taxonbar/testcases}}.
- Add tracking for entries not on Wikidata. Suggest differences be resolved.
جستارهای وابسته[ویرایش]
- {{Taxonbar}} الگوی اصلی.
- Template_talk:Taxonbar, Taxonbar discussion.
- پودمان:Authority control.
- gl:Módulo:Taxonbar, original code source for this template.
require('Module:No globals')
local conf = require( "Module:Taxonbar/conf" )
local function getIdsFromWikidata( item, property )
local ids = {}
if not item.claims[property] then
return ids
end
for _, statement in pairs( item.claims[property] ) do
if statement.mainsnak.datavalue then
table.insert( ids, statement.mainsnak.datavalue.value )
end
end
return ids
end
local function getLink( property, val )
local link = ''
if mw.ustring.lower(mw.ustring.sub(val, 1, 4)) == 'http' then
link = val
val = mw.ustring.match(val, '.*=(.-)$') or val
else
if type(property) == 'number' then
link = mw.wikibase.getEntityObject('P'..property).claims.P1630[1].mainsnak.datavalue.value
elseif type(property) == 'string' then
link = property
end
link = mw.ustring.gsub(link, '$1', val)
end
link = mw.ustring.gsub(link, '^[Hh][Tt][Tt][Pp]([Ss]?)://', 'http%1://')
if mw.ustring.find( link, '//' ) then
return '['..link..' '..val..']'
else
return '<span class="external">[['..link..'|'..val..']]</span>'
end
end
local function createRow( id, label, rawValue, link, withUid )
if link then
local outStr = '*<span style="white-space:nowrap;">' .. label .. ' <span'
if withUid then outStr = outStr..' class="uid"' end
return outStr..'>' .. link .. '</span></span>\n'
else
return '* <span class="error">The identifier ' .. id .. ' ' .. rawValue .. ' is not valid.</span>\n'
end
end
local function copyTable(inTable)
if type(inTable) ~= 'table' then return inTable end
local outTable = setmetatable({}, getmetatable(inTable))
for key, value in pairs (inTable) do outTable[copyTable(key)] = copyTable(value) end
return outTable
end
local p = {}
function p.authorityControlTaxon( frame )
local parentArgs = frame:getParent().args
local stringArgs = false
--Make args case insensitive
local tempArgs = copyTable(parentArgs)
for para, value in pairs( tempArgs ) do
if type(para) == 'string' then
local lpara = mw.ustring.lower(para)
if not parentArgs[lpara] or parentArgs[lpara] == '' then
parentArgs[lpara] = value
parentArgs[para] = nil
end
if value and value ~= '' and lpara ~= 'from' then stringArgs = true end
end
end
--remap aliases
for _, a in pairs( conf.aliases ) do
local k, v = mw.ustring.lower(a[1]), mw.ustring.lower(a[2])
if parentArgs[k] and not parentArgs[v] then
parentArgs[v] = parentArgs[k]
parentArgs[k] = nil
end
end
--Create rows
local elements, title = {}, {}
local item = mw.wikibase.getEntityObject(parentArgs['from'])
if parentArgs['from'] ~= nil then title = mw.title.new(item:getLabel()) else
title = mw.title.getCurrentTitle()
if not parentArgs['wikidata'] or not parentArgs['wikidata'] == '' then parentArgs['wikidata'] = mw.wikibase.getEntityIdForCurrentPage() end
end
if title.namespace == 0 or stringArgs then --Only in the main namespace or if there are manual overrides
--local rct = 0
for _, params in pairs( conf.databases ) do
params[1] = mw.ustring.lower(params[1])
--Wikidata fallback if requested
if (item ~= nil and item.claims ~= nil) and params[3] ~= 0 and (not parentArgs[params[1]] or parentArgs[params[1]] == '') then
local wikidataIds = getIdsFromWikidata( item, 'P' .. params[3] )
if wikidataIds[1] then
parentArgs[params[1]] = wikidataIds[1]
end
end
local val = parentArgs[params[1]]
if val and val ~= '' and mw.ustring.lower(val) ~= 'no' then
table.insert( elements, createRow( params[1], params[2] .. ':', val, getLink( params[3], val ), true ) )
--rct = rct + 1
end
end
local Navbox = require('Module:Navbox')
--local elementscats = ''
--if rct > 13 then
-- elementscats = '[[Category:AC with ' .. rct .. ' elements]]'
--end
if #elements ~= 0 then
return Navbox._navbox( {
name = 'Taxonbar',
bodyclass = 'hlist',
listclass = '',
group1 = '[[Help:Taxon identifiers|Taxon Identifiers]]', --.. elementscats,
list1 = table.concat( elements )
} )
else
return ""
end
end
end
return p