More Info
KPOP Image Download
  • Top University
  • Top Anime
  • Home Design
  • Top Legend



  1. ENSIKLOPEDIA
  2. Modul:Taxonbar - Wikipedia bahasa Indonesia, ensiklopedia bebas
Modul:Taxonbar - Wikipedia bahasa Indonesia, ensiklopedia bebas

Modul:Taxonbar

  • Afrikaans
  • Ænglisc
  • العربية
  • مصرى
  • Asturianu
  • Azərbaycanca
  • تۆرکجه
  • Basa Bali
  • Беларуская (тарашкевіца)
  • Banjar
  • ပအိုဝ်ႏဘာႏသာႏ
  • বাংলা
  • Bosanski
  • 閩東語 / Mìng-dĕ̤ng-ngṳ̄
  • کوردی
  • Čeština
  • Cymraeg
  • Dansk
  • Kadazandusun
  • English
  • فارسی
  • Suomi
  • Gaeilge
  • Galego
  • 客家語 / Hak-kâ-ngî
  • हिन्दी
  • Magyar
  • Հայերեն
  • Jaku Iban
  • Ilokano
  • 日本語
  • ಕನ್ನಡ
  • 한국어
  • मैथिली
  • Minangkabau
  • Македонски
  • മലയാളം
  • Bahasa Melayu
  • Malti
  • မြန်မာဘာသာ
  • नेपाली
  • Nederlands
  • ଓଡ଼ିଆ
  • ਪੰਜਾਬੀ
  • Kapampangan
  • Português
  • Română
  • ᱥᱟᱱᱛᱟᱲᱤ
  • Scots
  • Srpskohrvatski / српскохрватски
  • සිංහල
  • Simple English
  • Slovenčina
  • Slovenščina
  • Српски / srpski
  • தமிழ்
  • ᥖᥭᥰ ᥖᥬᥲ ᥑᥨᥒᥰ
  • తెలుగు
  • ไทย
  • Türkçe
  • Українська
  • Oʻzbekcha / ўзбекча
  • Tiếng Việt
  • Yorùbá
  • Vahcuengh
  • 中文
  • 閩南語 / Bân-lâm-gú
  • 粵語
Sunting pranala
  • Module
  • Pembicaraan
  • Baca
  • Lihat sumber
  • Lihat riwayat
Perkakas
Tindakan
  • Baca
  • Lihat sumber
  • Lihat riwayat
Umum
  • Pranala balik
  • Perubahan terkait
  • Pranala permanen
  • Informasi halaman
  • Lihat URL pendek
  • Unduh kode QR
Cetak/ekspor
  • Unduh sebagai PDF
  • Versi cetak
Dalam proyek lain
  • Wikispesies
  • Butir di Wikidata
Tampilan
Halaman yang dilindungi
Dari Wikipedia bahasa Indonesia, ensiklopedia bebas
Dokumentasi modul[lihat] [sunting] [riwayat] [segarkan]

Taxonbar (sunting bicara histori links # /subpages /doc /doc sunting /sbox /sbox diff /test) · Module:Taxonbar

WarningModul Lua ini digunakan pada 110+ halaman dan perubahannya kemungkinan memicu perubahan massal pada semua halaman yang menggunakannya. Uji cobalah di subhalaman /bak pasir atau /kasus uji Modul:Taxonbar, atau bak pasir modul Anda. Pertimbangkan untuk mendiskusikan perubahan di halaman pembicaraan sebelum mengimplementasikannya.
DiproteksiModul ini dilindungi. Modul ini sangat mencolok yang digunakan oleh banyak halaman, atau sangat sering disubstitusikan. Karena vandalisme atau kesalahan akan mempengaruhi banyak halaman, dan suntingan kecil dapat memberi beban besar pada server, modul ini dilindungi dari penyuntingan.
Halaman utama: Template:Taxonbar
Modul ini menggunakan satu properti Wikidata atau lebih; lihat § Taxon identifiers untuk penjelasannya.
Modul ini menggunakan Lua:
  • Module:Taxonbar/conf
  • Module:TaxonItalics
  • Module:ResolveEntityId
  • Module:Navbox
  • Module:If preview
Halaman terkait
  • Templat (bicara)
  • Bak pasir templat
  • Kasus uji templat
  • Dokumentasi templat
  • Subhalaman templat
  • Modul (bicara)
  • Bak pasir modul
  • Kasus uji modul
  • Dokumentasi modul
  • Subhalaman modul

Modul ini berisi kode untuk {{Taxonbar}}. Untuk menggunakan Taxonbar, ikuti petunjuk di Templat:Taxonbar/doc.

Konfigurasi

Parameter dan database diatur oleh Modul:Taxonbar/conf.

Kasus uji

Lihat pula: Template:Taxonbar/testcases dan Module:Taxonbar/sandbox

Untuk kasus uji gunakan: {{Taxonbar | from=QID}}

Bersihkan tembolok server

Rhododendron maximum

Pengidentifikasi takson
  • Wikidata: Q7061732
  • Wikispecies: Rhododendron maximum
  • EoL: 586660
  • EPPO: RHOMX
  • FEIS: rhomax
  • FNA: 250065640
  • GBIF: 2883094
  • GRIN: 31441
  • iNaturalist: 83059
  • IPNI: 219492-2
  • IRMNG: 10856123
  • ITIS: 23721
  • IUCN: 82889952
  • MoBotPF: 279985
  • NCBI: 191528
  • Plant List: tro-12300644
  • PLANTS: RHMA4
  • POWO: urn:lsid:ipni.org:names:219492-2
  • RHS: 15406
  • Tropicos: 12300644
  • VASCAN: 5560
  • WFO: wfo-0001047074

Asclepias syriaca

Pengidentifikasi takson
  • Wikidata: Q158295
  • Wikispecies: Asclepias syriaca
  • APA: 472
  • BioLib: 40535
  • EoL: 581277
  • EPPO: ASCSY
  • EUNIS: 152546
  • FNA: 220001219
  • GBIF: 3170247
  • GRIN: 4478
  • iNaturalist: 47911
  • IPNI: 94683-1
  • IRMNG: 10716074
  • ISC: 7249
  • ITIS: 30310
  • MichiganFlora: 162
  • MoBotPF: 276792
  • NBN: NHMSYS0021196575
  • NCBI: 48545
  • PalDat: Asclepias_syriaca
  • PfaF: Asclepias syriaca
  • PFI: 4076
  • Plant List: kew-2655219
  • PLANTS: ASSY
  • POWO: urn:lsid:ipni.org:names:319076-2
  • Tropicos: 2600005
  • VASCAN: 2711
  • WCSP: 501428
  • WiO: common-milkweed
  • WisFlora: 2644
  • WFO: wfo-0000551803

Persik (Prunus persica)

Pengidentifikasi takson
  • Wikidata: Q13189
  • Wikispecies: Prunus persica
  • AoFP: 389
  • APA: 3181
  • APDB: 84205
  • APNI: 112739
  • BioLib: 39540
  • BOLD: 252623
  • Calflora: 8724
  • Ecocrop: 1796
  • eFloraSA: Prunus_persica
  • EoL: 631649
  • EPPO: PRNPS
  • EUNIS: 179943
  • FloraBase: 46201
  • FNA: 242341609
  • GBIF: 3022511
  • GRIN: 30065
  • iNaturalist: 78755
  • IPNI: 1212858-2
  • ITIS: 24765
  • MichiganFlora: 2525
  • NBN: NBNSYS0000034215
  • NCBI: 3760
  • NSWFlora: Prunus~persica
  • NZOR: 291b67cc-accb-4e94-99ba-373dca8a50ea
  • NZPCN: 2854
  • PalDat: Prunus_persica
  • PFI: 2216
  • Plant List: rjp-376
  • PLANTS: PRPE3
  • POWO: urn:lsid:ipni.org:names:1212858-2
  • RHS: 156648
  • Tropicos: 27801115
  • VASCAN: 8872
  • VicFlora: 971d5046-dc8f-4408-b0d4-778ff68d8c05
  • WisFlora: 9122
  • WFO: wfo-0001005418

Puma (genus)

Pengidentifikasi takson
  • Wikidata: Q270748
  • Wikispecies: Puma
  • ADW: Puma
  • BOLD: 4372
  • EoL: 34428
  • Fossilworks: 41073
  • GBIF: 2435098
  • iNaturalist: 42006
  • IRMNG: 1405111
  • ITIS: 552375
  • MSW: 14000203
  • NCBI: 146712

Anjing (Canis lupus familiaris)

Pengidentifikasi takson
  • Wikidata: Q26972265
  • ADW: Canis_lupus_familiaris
  • EoL: 1228387
  • EPPO: CANIFA
  • GBIF: 6164210
  • ISC: 90295
  • ITIS: 726821
  • MSW: 14000752
  • NCBI: 9615
  • NZOR: db725874-7d02-4221-a93d-18894fb55417

Blue Bird Timur (Sialia sialis)

Pengidentifikasi takson
  • Wikidata: Q600880
  • Wikispecies: Sialia sialis
  • ABA: easblu
  • ADW: Sialia_sialis
  • ARKive: sialia-sialis
  • Avibase: A8347C7DF99F44B5
  • BirdLife: 22708550
  • BOLD: 16847
  • eBird: easblu
  • EPPO: SIALSI
  • Euring: 11340
  • FEIS: sisi
  • Fossilworks: 369289
  • GBIF: 2490941
  • GNAB: eastern-bluebird
  • IBC: eastern-bluebird-sialia-sialis
  • iNaturalist: 12942
  • IRMNG: 10197773
  • ITIS: 179801
  • IUCN: 22708550
  • NCBI: 172413
  • Neotropical: easblu
  • ODNR: eastern-bluebird
  • Xeno-canto: Sialia-sialis

Lebah madu (Apis)

Pengidentifikasi takson
  • Wikidata: Q102857
  • Wikispecies: Apis
  • ADW: Apis
  • AFD: Apis;Apini
  • BioLib: 70378
  • BOLD: 1937
  • BugGuide: 3079
  • EoL: 104135
  • EPPO: 1APISG
  • Fauna Europaea: 164774
  • Fauna Europaea (new): a8cc3594-078a-4470-8f3e-c130f44eef75
  • Fossilworks: 70716
  • GBIF: 1334757
  • iNaturalist: 47220
  • IRMNG: 1271578
  • ITIS: 154395
  • MNHN: apis
  • NBN: NHMSYS0000875422
  • NCBI: 7459
  • NZOR: 33c3b363-cfc7-4972-b7d0-0c5a7702effd
  • Plazi: EB9627B8-268D-0D80-98F8-7029E96DF821
  • ZooBank: 4132E584-2769-4B53-B2B7-E26DD62ECC7E

Lebah madu barat (Apis mellifera)

Pengidentifikasi takson
  • Wikidata: Q30034
  • Wikispecies: Apis mellifera
  • AFD: Apis_(Apis)_mellifera
  • ARKive: apis-mellifera
  • BioLib: 70379
  • BOLD: 21767
  • BugGuide: 3080
  • EoL: 1045608
  • EPPO: APISME
  • EUNIS: 254009
  • Fauna Europaea: 231852
  • Fauna Europaea (new): a8737456-b34b-4009-bc9f-5fdc5988b4ab
  • Fossilworks: 283625
  • GBIF: 1341976
  • iNaturalist: 47219
  • IRMNG: 11307057
  • ITIS: 154396
  • NBN: NHMSYS0000875423
  • NCBI: 7460
  • NZOR: 0ad225a4-927d-4819-9c60-e492ae83eeed
  • TSA: 2017
  • ZooBank: 9082C709-6347-4768-A0DC-27DC44400CB2

Kupu-kupu Clipper (Parthenos sylvia)

Pengidentifikasi takson
  • Wikidata: Q1955014
  • BioLib: 128937
  • BOLD: 26853
  • GBIF: 7346331
  • iNaturalist: 145621
  • NCBI: 191423

Trametes versicolor

Pengidentifikasi takson
  • Wikidata: Q753833
  • Wikispecies: Trametes versicolor
  • AusFungi: 60029766
  • BioLib: 59943
  • EoL: 190215
  • EPPO: CORLVE
  • EUNIS: 6082
  • FloraBase: 38844
  • Fungorum: 281625
  • GBIF: 2548311
  • iNaturalist: 54134
  • IRMNG: 10946545
  • MycoBank: 281625
  • NBN: NHMSYS0001499939
  • NCBI: 5325
  • NZOR: 43fdf902-fff3-497a-a07f-7fed0d77b853
  • Tropicos: 100405693

Jamur kancing / portobello (Agaricus bisporus)

Pengidentifikasi takson
  • Wikidata: Q227690
  • Wikispecies: Agaricus bisporus
  • AusFungi: 60022127
  • BioLib: 174980
  • EoL: 1004413
  • EPPO: AGARBI
  • FloraBase: 49940
  • Fungorum: 531546
  • GBIF: 5243447
  • iNaturalist: 61395
  • IRMNG: 11209605
  • MycoBank: 292246
  • NBN: NHMSYS0001473120
  • NCBI: 5341
  • NZOR: 4539f5d2-3aa0-4d47-a5bd-66784b818346


Lihat pula

  • Module:Taxonbar/conf – konfigurasi modul untuk menambah / menghapus / mengedit sumber
  • {{Taxonbar/exists}} – tes untuk mendeteksi keberadaan {{Taxonbar}}
  • {{Taxonbar/candidate}} – mengkategorikan kandidat penambahan {{Taxonbar}}
  • Module:Authority control – modul mirip {{Taxonbar}}-untuk subjek berbeda
  • gl:Módulo:Taxonbar – kode sumber asli pertama untuk modul ini
Dokumentasi di atas ditransklusikan dari Modul:Taxonbar/doc. (sunting | riwayat)
Penyunting dapat melakukan uji coba pada halaman bak pasir (buat | cermin) dan kasus uji (buat) modul ini.
Subhalaman modul ini.

local conf = require( 'Module:Taxonbar/conf' ) --configuration module
local TaxonItalics = require( 'Module:TaxonItalics' ) --use a function from Module:TaxonItalics to italicize a taxon name

--[[==========================================================================]]
--[[                             Local functions                              ]]
--[[==========================================================================]]

local function isNilOrEmpty( thing )
	if thing == nil or thing == '' then
		return true
	end
	return nil
end

local function getIdFromWikidata( item, property )
	local id = nil
	if property == 'PWikispecies:$1' then
		local siteLinks = item.sitelinks
		if siteLinks then
			local speciesWiki = item.sitelinks.specieswiki
			if speciesWiki then
				id = speciesWiki.title
			end
		end
		return id
	elseif item.claims[property] == nil then
		return id
	end
	for _, statement in pairs( item.claims[property] ) do
		if statement.mainsnak.datavalue then
			id = statement.mainsnak.datavalue.value
			break
		end
	end
	return id
end

local function getLink( property, val )
	local link, returnVal = '', {}
	
	returnVal.isError = false
	
	if mw.ustring.find( val, '//' ) then
		link = val
	else
		if type(property) == 'number' and property > 0 then
			local entityObject = mw.wikibase.getEntity('P'..property)
			local dataType
			
			if entityObject then dataType = entityObject.datatype
			else returnVal.isError = true end
			
			if dataType == 'external-id' then
				local formatterURL = nil
				if property == 3746 or --Wildflowers of Israel
				   property == 3795 or --Flora of Israel Online
				   property == 5397 --Tierstimmenarchiv
				then
					formatterURL = entityObject:getBestStatements('P1630')[2] --use 2nd formatterURL for English version
				end
				if formatterURL == nil then formatterURL = entityObject:getBestStatements('P1630')[1] end --default to [1]
				if formatterURL then
					if formatterURL.mainsnak.datavalue and formatterURL.mainsnak.datavalue.value then --nil check for ABA
						link = formatterURL.mainsnak.datavalue.value
					end
				end
			elseif dataType == 'url' then
				local subjectItem = entityObject:getBestStatements('P1629')[1]
				if subjectItem then
					local officialWebsite = mw.wikibase.getEntity(subjectItem.mainsnak.datavalue.value.id):getBestStatements('P856')[1]
					if officialWebsite then	link = officialWebsite.mainsnak.datavalue.value end
				end
			elseif dataType == 'string' then
				local formatterURL = entityObject:getBestStatements('P1630')[1]
				if formatterURL then
					link = formatterURL.mainsnak.datavalue.value
				else
					local subjectItem = entityObject:getBestStatements('P1629')[1]
					if subjectItem then
						local officialWebsite = mw.wikibase.getEntity(subjectItem.mainsnak.datavalue.value.id):getBestStatements('P856')[1]
						if officialWebsite then	link = officialWebsite.mainsnak.datavalue.value end
					end
				end
			else
				returnVal.isError = true
			end
		elseif type(property) == 'string' then
			link = property
		end
		
		local valurl = val
		if mw.ustring.find( link, 'antweb.org' ) then valurl = mw.ustring.gsub(valurl, ' ', '%%20') end
		if type(property) == 'number' then
			--doublecheck language for Wildflowers of Israel ID
			if property == 3746 then link = mw.ustring.gsub(link, '/hebrew/', '/english/') end
			--format spaces in PfaF binomials, e.g. "Elaeagnus x ebbingei"
			if property == 4301 then valurl = mw.ustring.gsub(valurl, ' ', '+') end
			--format spaces in FoAO2 binomials, e.g. "Scaevola basedowii"
			if property == 6756 then valurl = mw.ustring.gsub(valurl, ' ', '%%20') end --formerly "+", now "%20"
		end
		valurl = mw.ustring.gsub(valurl,'%%','%%%%')
		link = mw.ustring.gsub(link, '$1', valurl)
	end
	
	link = mw.ustring.gsub(link, '^[Hh][Tt][Tt][Pp]([Ss]?)://', 'http%1://') -- fix wikidata URL
	val = mw.ustring.match(val, '([^=/]*)/?$') -- get display name from end of URL
	if mw.ustring.find( link, '//' ) then
		returnVal.text = '['..link..' '..mw.text.encode(mw.uri.decode(val, 'PATH'),'%[%]')..']'
	elseif link == '' then
		returnVal.text = val
	else
		returnVal.text = '<span class="external">[['..link..'|'..val..']]</span>'
	end
	return returnVal
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 '* ' .. mw.text.tag('span', {class='error'}, 'The identifier ' .. id .. ' ' .. rawValue .. ' is not valid.') .. '\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 = {}

--[[==========================================================================]]
--[[                                   Main                                   ]]
--[[==========================================================================]]

function p.authorityControlTaxon( frame )
	local resolveEntity = require( 'Module:ResolveEntityId' )
	local parentArgs = copyTable(frame:getParent().args)
	local currentTitle = mw.title.getCurrentTitle()
	local currentEntityId = mw.wikibase.getEntityIdForCurrentPage()
	
	local stringArgs = false
	local fromTitleCount, firstRow, rowCount = 1, 0, 0
	local outString, errors = '', ''
	local tFroms = {} --non-sequential table of unique froms
	local iFroms = 0 --integer size of tFroms, b/c Lua
	local categories = {
		'[[Kategori:Taxonbar tanpa parameter from]]',
		'[[Kategori:Taxonbar tidak sinkron dengan Wikidata]]',
		'', -- [3] placeholder for [[Category:Taxonbars using multiple manual Wikidata items]]
		'', -- [4] placeholder for [[Category:Taxonbars with invalid from parameters]]
		'', -- [5] placeholder for [[Category:Taxonbars using manual taxon IDs]]
		'', -- [6] placeholder for [[Category:Taxonbar pages requiring a Wikidata item]]
		'', -- [7] placeholder for [[Category:Taxonbars without primary Wikidata taxon IDs]]
		'', -- [8] placeholder for [[Category:Taxonbars without secondary Wikidata taxon IDs]]
		'', -- [9] placeholder for [[Category:Taxonbars with duplicate from parameters]]
		'', --[10] placeholder for [[Category:Taxonbars with manual taxon IDs differing from Wikidata]]
		'', --[11] placeholder for [[Category:Taxonbars with manual taxon IDs identical to Wikidata]]
		'', --[12] placeholder for [[Category:Taxonbars on possible non-taxon pages]]
		'', --[13] placeholder for [[Category:Taxonbars with automatically added basionyms]]
		'', --[14] placeholder for [[Category:Taxonbars with automatically added original combinations]]
		'', --[15] placeholder for [[Category:Taxonbars with automatically added monotypic genera]]
		'', --[16] placeholder for [[Category:Taxonbars of monotypic species missing genera]]
		'', --[17] placeholder for [[Category:Taxonbars with unknown parameters]]
		'', --[18] placeholder for [[Category:Taxonbars with 20–24 taxon IDs]]
		'', --[19] placeholder for [[Category:Taxonbars with 25–29 taxon IDs]]
		'', --[20] placeholder for [[Category:Taxonbars with 30–34 taxon IDs]]
		'', --[21] placeholder for [[Category:Taxonbars with 35–39 taxon IDs]]
		'', --[22] placeholder for [[Category:Taxonbars with 40+ taxon IDs]]
		'', --[23] placeholder for [[Category:Taxonbars with from2 matching article title & QID]]
		'', --[24] placeholder for [[Category:Taxonbars with from2 matching article title]]
		'', --[25] placeholder for [[Category:Taxonbars with unnamed parameters]]
	}
	local acceptableInstanceOf_Strict = {
	   ['Q16521'] = 'taxon',                      --strict
	   ['Q310890'] = 'monotypic taxon',           --strict
	   ['Q2568288'] = 'ichnotaxon',               --strict
	   ['Q23038290'] = 'fossil taxon',            --strict
	   ['Q47487597'] = 'monotypic fossil taxon',  --strict
	}
	local acceptableInstanceOf_All = {
	   ['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
	}
	
	--Assess the page's relationship with Wikidata
	local currentItem = nil
	if currentTitle.namespace == 10 then --i.e. Module:Taxonbar/sandbox, Template:Taxonbar/doc, etc.
		if resolveEntity._id(parentArgs['from']) then
			currentItem = mw.wikibase.getEntity(parentArgs['from'])
		end
		if currentItem == nil then
			if resolveEntity._id(parentArgs['from1']) then
				currentItem = mw.wikibase.getEntity(parentArgs['from1'])
			end
		end
	elseif resolveEntity._id(currentEntityId) then
		currentItem = mw.wikibase.getEntity(currentEntityId)
	else --currentEntityId == nil/unresolvable
		categories[6] = '[[Kategori:Halaman taxonbar yang membutuhkan item Wikidata]]'
	end
	if currentItem then
		categories[12] = '[[Kategori:Taxonbar pada halaman yang kemungkinan non-takson]]' --unset if acceptable found
		for _, instanceOfState in pairs ( currentItem:getBestStatements('P31') ) do --instance of
			local instanceOf = instanceOfState.mainsnak.datavalue.value.id
			if acceptableInstanceOf_All[instanceOf] then
				categories[12] = ''
				break
			end
		end
	end
	
	--Cleanup args
	for k, v in pairs( frame:getParent().args ) do
		if type(k) == 'string' then
			--make args case insensitive
			local lowerk = mw.ustring.lower(k)
			if isNilOrEmpty( parentArgs[lowerk] ) then
				parentArgs[k] = nil
				parentArgs[lowerk] = v
			end
			--remap abc to abc1
			if mw.ustring.find(lowerk,'%d$') == nil then --if no number at end of param
				if isNilOrEmpty( parentArgs[lowerk..'1'] ) then
					parentArgs[lowerk] = nil
					lowerk = lowerk..'1'
					parentArgs[lowerk] = v
				end
			end
			if v and v ~= '' then
				--remap 'for' to 'title'
				if mw.ustring.sub(lowerk,1,3) == 'for' then
					local forTitle = mw.ustring.gsub(lowerk,'^for','title',1)
					if isNilOrEmpty( parentArgs[forTitle] ) then
						parentArgs[lowerk] = nil
						lowerk = forTitle
						parentArgs[lowerk] = v
					end
				end
				--find highest from or title param
				if mw.ustring.sub(lowerk,1,4) == 'from' then
					local fromNumber = tonumber(mw.ustring.sub(lowerk,5,-1))
					if fromNumber and fromNumber >= fromTitleCount then fromTitleCount = fromNumber end
					--look for duplicate froms while we're here
					if mw.ustring.find(v, '^Q%d') then
						if tFroms[v] then
							categories[9] = '[[Kategori:Taxonbar dengan parameter from duplikat]]'
							tFroms[v] = tFroms[v] + 1
						else
							tFroms[v] = 1
							iFroms = iFroms + 1
						end
						if iFroms == 2 then
							categories[3] = '[[Kategori:Taxonbar yang menggunakan banyak item Wikidata manual]]'
						end
					end
				elseif mw.ustring.sub(lowerk,1,5) == 'title' then
					local titleNumber = tonumber(mw.ustring.sub(lowerk,4,-1))
					if titleNumber and titleNumber >= fromTitleCount then fromTitleCount = titleNumber end
				elseif mw.ustring.lower(v) ~= 'no' then
					stringArgs = true
					categories[5] = '[[Kategori:Taxonbar yang menggunakan ID takson manual]]'
				end
			end
		end
	end
	
	--Check for unknown parameters
	--create knowns list
	local acceptableArgs = { from = true, } --master list of l/c acceptable args
	for _, d in pairs( conf.databases ) do
		if d[1] ~= 'Wikidata' then --made obsolete by from
			acceptableArgs[mw.ustring.lower(d[1])] = true
		end
	end
	for _, a in pairs( conf.aliases ) do
		acceptableArgs[mw.ustring.lower(a[1])] = true
	end
	--create trimmed parents list
	local baseParentArgs = {} --condensed list of l/c parent args w/o trailing #s
	for k, v in pairs( parentArgs ) do
		if type(k) == 'string' then
			local lowerk = mw.ustring.lower(k)
			local base = mw.ustring.gsub(lowerk, '[%d]*$', '')
			baseParentArgs[base] = true
		elseif type(k) == 'number' then
			categories[25] = '[[Kategori:Taxonbar dengan parameter tak bernama|' .. k .. ']]'
		end
	end
	--compare lists and spit out unknowns
	-- TODO: Fix bug; this is only finding one invalid parameter when the invalid
	-- parameters have a value.
	local unknownParams = {}
	for k, v in pairs( baseParentArgs ) do
		if acceptableArgs[k] == nil then
			categories[17] = '[[Kategori:Taxonbar dengan parameter tak dikenali|' .. k ..']]'
			unknownParams[#unknownParams + 1] = k
		end
	end
	--warn if unknown(s) present
	if #unknownParams > 0 then
		local plural = 's'
		local itthem = 'them'
		if #unknownParams == 1 then
			plural = ''
			itthem = 'it'
		end
		errors = errors .. require('Module:If preview')._warning({
			mw.ustring.format(
				'Parameter tidak dikenali: %s <code>%s</code>. Mohon koreksi %s atau pertimbangkan untuk menambahkan %s ke Wikidata.',
				plural,
				table.concat(unknownParams, '</code>, <code>'),
				itthem,
				itthem
			)
		})
	end
	
	--Append basionym to arg list, if not already provided
	if currentItem then
		local currentBasState = currentItem:getBestStatements('P566')[1] --basionym
		if currentBasState then
			local basionymId = currentBasState.mainsnak.datavalue.value.id
			if basionymId and resolveEntity._id(basionymId) and tFroms[basionymId] == nil then
				--check that basionym is a strict instance of taxon
				local basionymItem = mw.wikibase.getEntity(basionymId)
				if basionymItem then
					for _, instanceOfState in pairs ( basionymItem:getBestStatements('P31') ) do --instance of
						local instanceOf = instanceOfState.mainsnak.datavalue.value.id
						if acceptableInstanceOf_Strict[instanceOf] then
							--housekeeping
							tFroms[basionymId] = 1
							iFroms = iFroms + 1
							fromTitleCount = fromTitleCount + 1
							--append basionym & track
							parentArgs['from'..fromTitleCount] = basionymId
							categories[13] = '[[Kategori:Taxonbar dengan basionim ditambahkan secara otomatis]]'
							break
	end	end	end	end	end	end
	
	--Append original combination to arg list, if not already provided
	if currentItem then
		local currentOCState = currentItem:getBestStatements('P1403')[1] --original combination
		if currentOCState then
			local orcoId = currentOCState.mainsnak.datavalue.value.id
			if orcoId and resolveEntity._id(orcoId) and tFroms[orcoId] == nil then
				--check that orco is a strict instance of taxon
				local orcoItem = mw.wikibase.getEntity(orcoId)
				if orcoItem then
					for _, instanceOfState in pairs ( orcoItem:getBestStatements('P31') ) do --instance of
						local instanceOf = instanceOfState.mainsnak.datavalue.value.id
						if acceptableInstanceOf_Strict[instanceOf] then
							--housekeeping
							tFroms[orcoId] = 1
							iFroms = iFroms + 1
							fromTitleCount = fromTitleCount + 1
							--append orco & track
							parentArgs['from'..fromTitleCount] = orcoId
							categories[14] = '[[Kategori:Taxonbar dengan kombinasi asli ditambahkan secara otomatis]]'
							break
	end	end	end	end	end	end
	
	--Append monotypic genus/species to arg list of monotypic species/genus, if not already provided
	if currentItem then
		for _, instanceOfState in pairs ( currentItem:getBestStatements('P31') ) do --instance of
			local taxonRank = nil
			local parentItem = nil
			local parentTaxon = nil
			local parentTaxonRank = nil
			local parentMonoGenus = nil --holy grail/tbd
			local instanceOf = instanceOfState.mainsnak.datavalue.value.id
			if instanceOf and (instanceOf == 'Q310890' or instanceOf == 'Q47487597') then --monotypic/fossil taxon
				local taxonRankState = currentItem:getBestStatements('P105')[1] --taxon rank
				if taxonRankState then taxonRank = taxonRankState.mainsnak.datavalue.value.id end
				
				if taxonRank and taxonRank == 'Q7432' then --species
					--is monotypic species; add genus
					local parentTaxonState = currentItem:getBestStatements('P171')[1] --parent taxon
					if parentTaxonState then parentTaxon = parentTaxonState.mainsnak.datavalue.value.id end
					--confirm parent taxon rank == genus & monotypic
					if parentTaxon and resolveEntity._id(parentTaxon) then
						parentItem = mw.wikibase.getEntity(parentTaxon)
						if parentItem then
							local parentTaxonRankState = parentItem:getBestStatements('P105')[1] --taxon rank
							if parentTaxonRankState then parentTaxonRank = parentTaxonRankState.mainsnak.datavalue.value.id end
							if parentTaxonRank and parentTaxonRank == 'Q34740' then --parent == genus
								for _, parentInstanceOfState in pairs ( parentItem:getBestStatements('P31') ) do --instance of
									local parentInstanceOf = parentInstanceOfState.mainsnak.datavalue.value.id 
									if parentInstanceOf and
									  (parentInstanceOf == 'Q310890' or parentInstanceOf == 'Q47487597') then --monotypic/fossil taxon
										parentMonoGenus = parentTaxon --confirmed
										break
									end
								end
								if parentMonoGenus and tFroms[parentMonoGenus] == nil then
									--housekeeping
									tFroms[parentMonoGenus] = 1
									iFroms = iFroms + 1
									fromTitleCount = fromTitleCount + 1
									--append monotypic genus & track
									parentArgs['from'..fromTitleCount] = parentMonoGenus
									categories[15] = '[[Kategori:Taxonbar dengan genera monotipik ditambahkan secara otomatis]]'
									break
								end
							end
						end
					end
					if parentMonoGenus == nil or tFroms[parentMonoGenus] == nil then
						categories[16] = '[[Kategori:Taxonbar spesies monotipik tanpa genera]]'
						break
					end
				elseif taxonRank and taxonRank == 'Q34740' then --genus
					--is monotypic genus; add species
					--...
				end
				
			end
		end
	end --if currentItem
	
	--Setup navbox
	local navboxParams = {
		name  = 'Taxonbar',
		bodyclass = 'hlist',
		listclass = '',
		groupstyle = 'text-align: left;',
	}
	
	for f = 1, fromTitleCount, 1
	do
		local elements, title = {}, nil
		--cleanup parameters
		if parentArgs['from'..f] == '' then parentArgs['from'..f] = nil end
		if parentArgs['title'..f] == '' then parentArgs['title'..f] = nil end
		--remap aliases
		for _, a in pairs( conf.aliases ) do
			local alias, name = mw.ustring.lower(a[1]), mw.ustring.lower(a[2])
			if parentArgs[alias..f] and parentArgs[name..f] == nil then
				parentArgs[name..f] = parentArgs[alias..f]
				parentArgs[alias..f] = nil
			end
		end
		--Fetch Wikidata item
		local from = resolveEntity._id(parentArgs['from'..f])
		local item = mw.wikibase.getEntity(from)
		local label = nil
		if type(item) == 'table' then
			local statements = item:getBestStatements('P225')[1] --taxon name
			if statements then
				local datavalue = statements.mainsnak.datavalue
				if datavalue then
					label = datavalue.value
				end
			end
			label = label or item:getLabel()
		else
			if parentArgs['from'..f] then
				categories[1] = ''
				categories[4] = '[[Kategori:Taxonbar dengan parameter from tidak sah]]'
				errors = errors .. mw.text.tag('strong', {class='error'}, 'Galat: "' .. 
				         parentArgs['from'..f] .. '" bukan ID entitas Wikidata yang sah.<br />')				
			end
		end
		if label and label ~= '' then
			title = mw.title.new(label)
		end
		if title == nil and parentArgs['title'..f] then
			title = mw.title.new(parentArgs['title'..f])
		end
		if title == nil and f == 1 then
			title = currentTitle
		end
		
		if title then
			if isNilOrEmpty( parentArgs['wikidata'..f] ) and 
			   (title.namespace == 0) then
				if parentArgs['from'..f] then
					parentArgs['wikidata'..f] = parentArgs['from'..f]
				elseif item then
					parentArgs['wikidata'..f] = item.id
				end
			end
			if title.namespace == 0 or stringArgs then --only in mainspace or if manual overrides exist
				local sourceCount = 0
				for _, params in pairs( conf.databases ) do
					params[1] = mw.ustring.lower(params[1])
					local propId = params[3]
					--Wikidata fallback if requested
					if (item and item.claims) and
					   (type(propId) == 'string' or (type(propId) == 'number' and propId > 0)) then
						local wikidataId = getIdFromWikidata( item, 'P' .. propId )
						local v = parentArgs[params[1]..f]
						if wikidataId then
							if isNilOrEmpty(v) then
								parentArgs[params[1]..f] = wikidataId
							else
								if v and v ~= 'no' and v ~= wikidataId then
									categories[10] = '[[Kategori:Taxonbar dengan ID takson manual berbeda dengan Wikidata]]'
								elseif v and v == wikidataId then
									categories[11] = '[[Kategori:Taxonbar dengan ID takson manual sama dengan Wikidata]]'
								end
							end
						end
					end
					local val = parentArgs[params[1]..f]
					if val and val ~= '' and mw.ustring.lower(val) ~= 'no' then
						if type(propId) == 'number' then
							if propId < 0 then propId = -propId end --allow link
							if propId > 0 then --link
								table.insert( elements, createRow( params[1], params[2]..':', val, getLink( propId, val ).text, true ) )
							else --propId == 0; no link
								table.insert( elements, createRow( params[1], params[2]..':', val, val, true ) )
							end
						else
							table.insert( elements, createRow( params[1], params[2]..':', val, getLink( propId, val ).text, true ) )
						end
						if params[1] ~= 'wikidata' and params[1] ~= 'wikispecies' then
							sourceCount = sourceCount + 1
						end
					end
				end
				
				if     sourceCount >= 40 then categories[22] = '[[Kategori:Taxonbar dengan 40+ ID takson]]'
				elseif sourceCount >= 35 then categories[21] = '[[Kategori:Taxonbar dengan 35–39 ID takson]]' --endashes
				elseif sourceCount >= 30 then categories[20] = '[[Kategori:Taxonbar dengan 30–34 ID takson]]'
				elseif sourceCount >= 25 then categories[19] = '[[Kategori:Taxonbar dengan 25–29 ID takson]]'
				elseif sourceCount >= 20 then categories[18] = '[[Kategori:Taxonbar dengan 20–24 ID takson]]'
				end
				
				--Generate navbox title
				if sourceCount > 0 then
					rowCount = rowCount + 1
					if firstRow == 0 then firstRow = f end
					--set title from wikidata if it doesn't exist
					if isNilOrEmpty( parentArgs['title'..f] ) then
						parentArgs['noTitle'..f] = true
						parentArgs['title'..f] = title.text
					end
					--if it exists now, set row heading to title
					if not isNilOrEmpty( parentArgs['title'..f] ) then
						navboxParams['group'..f] = TaxonItalics.italicizeTaxonName(parentArgs['title'..f], false)
					else
						navboxParams['group'..f] = ''
					end
					navboxParams['list'..f] = table.concat( elements )
				elseif currentEntityId and (currentEntityId == parentArgs['from'..f] or fromTitleCount == 1) then
					categories[7] = '[[Kategori:Taxonbar tanpa ID takson utama Wikidata]]'
				else
					categories[8] = '[[Kategori:Taxonbar tanpa ID takson Wikidata sekunder]]'
				end
				
				--Categorize
				if not isNilOrEmpty( parentArgs['from'..f] ) then
					--blank "missing from" if 'from' exists
					categories[1] = ''
					--blank "desynced" if 'from' matches current page
					if parentArgs['from'..f] == currentEntityId then categories[2] = '' end
				end
					--cannot be "desynced" if no 'from' params
				if categories[1] ~= '' then categories[2] = '' end
			end
		end
	end --for f = 1, fromTitleCount, 1
	
	if rowCount > 0 then
		local Navbox = require('Module:Navbox')
		if rowCount > 1 then
			--remove duplicates and move page title to top
			local rowIDs = {}
			for f = 1,fromTitleCount,1
			do
				if not isNilOrEmpty( parentArgs['title'..f] ) then
					if rowIDs[parentArgs['wikidata'..f]] then --remove duplicate
						navboxParams['group'..f] = nil
						navboxParams['list'..f] = nil
					else
						rowIDs[parentArgs['wikidata'..f]] = true
--removed behavior forcing "WD-WP pagename match row" move to top, per [[Template talk:Taxonbar#Deprecated values from wikidata]]
--						if f > firstRow and (parentArgs['title'..f] == currentTitle.text or 
--						   parentArgs['wikidata'..f] == currentEntityId) then --move item linked to page to top
--							if navboxParams['group'..f] and 
--							   navboxParams['group'..f] ~= '' and 
--							   navboxParams['list'..f] and 
--							   navboxParams['list'..f] ~= '' then
--								local tempGroup, tempList = navboxParams['group'..f], navboxParams['list'..f]
--								navboxParams['group'..f], navboxParams['list'..f] = navboxParams['group'..firstRow], navboxParams['list'..firstRow]
--								navboxParams['group'..firstRow], navboxParams['list'..firstRow] = tempGroup, tempList
--							end
--						end
					end
				end
			end
			if parentArgs['title'..2] and parentArgs['title'..2] == currentTitle.text then
				if parentArgs['from'..2] == currentItem['id'] then
					categories[23] = '[[Kategori:Taxonbar dengan from2 yang cocok dengan judul artikel & QID]]'
				else
					categories[24] = '[[Kategori:Taxonbar dengan from2 yang cocok dengan judul artikel]]'
				end
			end
			--adjust navbox for number of rows
			navboxParams['title'] = '[[Bantuan:Pengidentifikasi takson|Pengidentifikasi takson]]'
			if rowCount >= 4 then
				navboxParams['navbar'] = 'plain'
			else
				navboxParams['state'] = 'off'
				navboxParams['navbar'] = 'off'
			end
		elseif parentArgs['noTitle'..firstRow] then
			navboxParams['group'..firstRow] = '[[Bantuan:Pengidentifikasi takson|Pengidentifikasi takson]]'
		else
			navboxParams['group'..firstRow] = '[[Bantuan:Pengidentifikasi takson|Pengidentifikasi takson]]<br />' .. navboxParams['group'..firstRow]
		end
		
		--return navbox
		outString = Navbox._navbox(navboxParams)
	end --if rowCount > 0
	
	--Add categories
	if string.sub(currentTitle.subpageText,1,9) == 'testcases' then parentArgs['demo'] = true end
	if not isNilOrEmpty( parentArgs['demo'] ) then
		outString = outString .. mw.text.nowiki(table.concat(categories)) .. '<br />'
	elseif currentTitle.namespace == 0 then
		outString = outString .. table.concat(categories)
	end
	
	return outString .. errors
end

return p
Diperoleh dari "https://id.wikipedia.org/w/index.php?title=Modul:Taxonbar&oldid=25489981"
Kategori:
  • Modul yang dilindungi
  • Modules using data from Wikidata
  • Sidebar dengan style yang membutuhkan konversi
Kategori tersembunyi:
  • Halaman Wikipedia yang dilindungi penuh

Best Rank
More Recommended Articles