| Modul ini dinilai sebagai modul alfa. Modul ini sudah siap untuk input dari pihak ketiga, dan bisa digunakan dalam beberapa halaman untuk melihat apakah ada masalah yang timbul, namun harus terus diawasi. Saran untuk fitur baru atau perubahan dalam mekanisme input dan output dipersilahkan.Taxobox ranks |
Dokumentasi di atas ditransklusikan dari Modul:Taxobox ranks/doc. (sunting | riwayat)
Penyunting dapat melakukan uji coba pada halaman bak pasir (buat | cermin) dan kasus uji (buat) modul ini.
Subhalaman modul ini.
Penyunting dapat melakukan uji coba pada halaman bak pasir (buat | cermin) dan kasus uji (buat) modul ini.
Subhalaman modul ini.
--[[************************************************************************* This module provides support to the automated taxobox system – the templates Automatic taxobox, Speciesbox, Subspeciesbox, Infraspeciesbox, etc. In particular it is part of the configuration of the system, defining the rank names that are recognized and the way they are displayed in English in taxoboxes and viewed taxonomy templates. *****************************************************************************]] require('strict') localTableRow='|-\n' localTableEnd='|}\n' localp={}-- functions made public locall={}-- internal functions, kept separate --*************************** CONFIGURATION ********************************* --[[============================ ranks ====================================== Set up a constant to hold the rank names and their Indonesian equivalents. If adding to this list, note that rank names containing spaces or - must be enclosed in [' ']. =============================================================================]] localranks= { --Special cases, alphabetic order alliance='<i>Aliansi</i>', ['basic shell type']='<i>Tipe cangkang dasar</i>', branch='<i>Cabang</i>', clade='<i>Klad</i>', cladus='<i>Klad</i>', ['form taxon']='<i>Takson bentuk</i>', grade='<i>Tingkatan</i>', gradus='<i>Tingkatan</i>', informal='<i>Kelompok informal</i>', ['informal group']='<i>Kelompok informal</i>', morphotype='<i>Morfotipe</i>', node='<i>Simpul</i>', plesion='<i>Plesion</i>', ['plesion-group']='<i>Kelompok plesion</i>', ['possible clade']='<i>Klad?</i>', ['species complex']='<i>Kompleks spesies</i>', ['species group']='<i>Kelompok spesies</i>', ['species subgroup']='<i>Subkelompok spesies</i>', ['stem group']='<i>Kelompok batang</i>', ['total group']='<i>Kelompok total</i>', --Special virus ranks realm='Dunia', serotype='Serotipe', strain='Strain', virus='Virus', ['virus group']='Kelompok', --Linnaean taxonomy, alphabetic order classis='Kelas', cohort='Kohort', divisio='Divisi', domain='Domain', epifamilia='Epifamili', familia='Famili', forma='Forma', genus='Genus', grandordo='Grandordo', ['grandordo-mb']='Grandordo', hyperfamilia='Hiperfamili', infraclassis='Infrakelas', infralegio='Infralegio', infralegion='Infralegio', infraordo='Infraordo', infraphylum='Infrafilum', infraregnum='Infrakerajaan', infratribus='Infratribus', legio='Legio', legion='Legio', magnordo='Magnordo', micrordo='Mikrordo', microphylum='Mikrofilum', mirordo='Mirordo', ['mirordo-mb']='Mirordo', nanordo='Nanordo', nanophylum='Nanofilum', ordo='Ordo', parafamilia='Parafamili', parvclassis='Parvkelas', parvordo='Parvordo', phylum='Filum', regnum='Kerajaan', sectio='Seksi', series='Seri', species='Spesies', subclassis='Subkelas', subcohort='Subkohort', subdivisio='Subdivisi', subfamilia='Subfamili', subgenus='Subgenus', sublegio='Sublegio', sublegion='Sublegio', subordo='Subordo', subphylum='Subfilum', subregnum='Subkerajaan', subsectio='Subseksi', subseries='Subseri', subspecies='Subspesies', subterclassis='Subterkelas', subtribus='Subtribus', superclassis='Superkelas', supercohort='Superkohort', superdivisio='Superdivisi', superdomain='Superdomain', superfamilia='Superfamili', superlegio='Superlegio', superlegion='Superlegio', superordo='Superordo', superphylum='Superfilum', superregnum='Superkerajaan', supersectio='Superseksi', supertribus='Supertribus', tribus='Tribus', varietas='Varietas', zoodivisio='Zoodivisi', zoosectio='Zooseksi', zooseries='Zooseri', zoosubdivisio='Zoosubdivisi', zoosubsectio='Zoosubseksi', --trace fossil taxonomy, alphabetic order-->', ichnoclassis='Ichnokelas', ichnocohort='Ichnokohort', ichnodivisio='Ichnodivisi', ichnofamilia='Ichnofamili', ichnogenus='Ichnogenus', ichnograndordo='Ichnograndordo', ['ichnograndordo-mb']='Ichnograndordo',--McKenna & Bell version ichnoinfraclassis='Ichnoinfrakelas', ichnoinfradivisio='Ichnoinfradivisi', ichnoinfraordo='Ichnoinfraordo', ichnolegio='Ichnolegion', ichnolegion='Ichnolegion', ichnomagnordo='Ichnomagnordo', ichnomicrordo='Ichnomikrordo', ichnoordo='Ichnoordo', ichnoparvordo='Ichnoparvorder', ichnospecies='Ichnospecies', ['ichnostem-group']='Ichnostem-Group', ichnosubclassis='Ichnosubkelas', ichnosubdivisio='Ichnosubdivisi', ichnosubfamilia='Ichnosubfamili', ichnosublegio='Ichnosublegion', ichnosublegion='Ichnosublegion', ichnosubordo='Ichnosubordo', ichnosuperclassis='Ichnosuperkelas', ichnosupercohort='Ichnosupercohort', ichnosuperfamilia='Ichnosuperfamili', ichnosuperordo='Ichnosuperordo', --fossilized egg taxonomy, alphabetic order ooclassis='Ookelas', oocohort='Ookohort', oofamilia='Oofamili', oogenus='Oogenus', oomagnordo='Oomagnordo', oordo='Oordo', oospecies='Oospesies', oosubclassis='Oosubkelas', oosubgenus='Oosubgenus', oosubspecies='Oosubspesies', oosupercohort='Oosuperkohort', oosuperordo='Oosuperorder', } --[[========================== rank values=================================== Constant to set up a table of numerical values corresponding to 'Linnaean' ranks, with upper ranks having higher values. In a valid taxonomic hierarchy, a lower rank should never have a higher value than a higher rank. The actual numerical values are arbitrary so long as they are ordered. The ranks should be a subset of those in Template:Anglicise ranks. =============================================================================]] localrankValTable= { classis=1400, cohort=1100, divisio=1500, domain=1700, epifamilia=802, familia=800, forma=100, genus=600, grandordo=1005, ['grandordo-mb']=1002, hyperfamilia=805; infraclassis=1397, infralegio=1197, infralegion=1197, infraordo=997, infraphylum=1497, infraregnum=1597, infratribus=697, legio=1200, legion=1200, magnordo=1006, microphylum=1495, micrordo=995, mirordo=1004, ['mirordo-mb']=1001, nanophylum=1494, nanordo=994, ordo=1000, parafamilia=800, parvclassis=1396;-- same as subterclassis parvordo=996, phylum=1500, regnum=1600, sectio=500, --series = 400, used too inconsistently to check species=300, subclassis=1398, subcohort=1098, subdivisio=1498, subfamilia=798, subgenus=598, sublegio=1198, sublegion=1198, subordo=998, subphylum=1498, subregnum=1598, subsectio=498, subspecies=298, subterclassis=1396;-- same as parvclassis subtribus=698, superclassis=1403, supercohort=1103, superdivisio=1503, superdomain=1703, superfamilia=803, superlegio=1203, superlegion=1203, superordo=1003, superphylum=1503, superregnum=1603, supersectio=503, supertribus=703, tribus=700, varietas=200, zoodivisio=1300, zoosectio=900, zoosubdivisio=1298, zoosubsectio=898, } --***************** Process ranks + English equivalents ********************* --[[======================== angliciseRank ================================== Returns the English language equivalent of a rank name used in a taxonomy template. If the rank name is not in the table of ranks, then the first letter of the rank name is capitalized and used as the English name. If checked=yes, then the generated English name is highlighted in red. If called from a taxonomy template, the page is put in Category:Taxonomy templates using capitalized rank parameters =============================================================================]] functionp.doAngliciseRank(rankName,check) rankName=string.gsub(rankName,'_',' ')-- replace all underscores by spaces -- is rankName capitalized? localtestName=string.lower(string.sub(rankName,1,1))..string.sub(rankName,2) localwasCapitalized=testName~=rankName ifwasCapitalizedthenrankName=testNameend-- try uncapitalized version ifstring.sub(rankName,1,8)=='unranked'thenreturn'(tanpa takson)'end -- now look for an English version of the rank name localres=ranks[rankName] localnotFound=notres ifnotFoundthen --rankName is not in the table of recognized ranks; just capitalize rankName res=string.upper(string.sub(rankName,1,1))..string.sub(rankName,2) end ifcheck=='no'then returnres elseifnotFoundthen res='<span style="background-color:#F99">'..res..'</span>'-- highlight returned English name end -- tracking categories required only if called from a taxonomy template localpageTitle=mw.title.getCurrentTitle() ifpageTitle.nsText=='Template'andpageTitle.rootText=='Taxonomy'then ifnotFoundthenres=res..'[[Kategori:Templat taksonomi menggunakan parameter peringkat yang tidak dikenal]]' elseifwasCapitalizedthenres=res..'[[Kategori:Templat taksonomi menggunakan parameter peringkat kapital]]' end end returnres end functionp.angliciseRank(frame) localrankName=frame.args[1] localcheck=frame.args['check']or'no' returnp.doAngliciseRank(rankName,check) end --[[========================== showRanks ==================================== Returns a wikitable showing all the recognized ranks, how they are shown in taxoboxes, whether they are automatically italicized, and whether they are checked for consistency of rank order. Usage: {{#invoke:Taxobox ranks|showRanks}} =============================================================================]] functionp.showRanks(frame) localres='{| class="wikitable sortable"\n' res=res..'|+ Peringkat yang dikenali dalam templat taksonomi\n' res=res..'!style="text-align: left;"|Nama peringkat dalam<br/>tempat<br/>taksonomi' res=res..'!!style="text-align: left;"|Tampil dalam<br/>taxobox sebagai' res=res..'!! style="text-align: left;" |Nama takson<br/>otomatis<br/>miring?' res=res..'!! style="text-align: left;" |Peringkat diperiksa<br/>untuk urutan<br/>konsisten?' res=res..'\n' fork,tinpairs(ranks)do res=res..TableRow..'|'..k..'||'..t..'||'..frame:expandTemplate{title='Is italic taxon',args={k}}..'||'..l.hasRankVal(k)..'\n' end returnres..TableEnd end --************************* Process rank values ***************************** --[[========================= lookupRankVal ================================= Function to look up the arbitrary numerical value of a rank in a rank value table. "Ichno" and "oo" ranks are not stored separately, so if present the prefix is removed. =============================================================================]] functionp.lookupRankVal(rank) localrankVal=rankValTable[rank] ifnotrankValthen -- may be an "ichno" or "oo" rank; try removing "ichno-" or "oo-" localbaseRank=mw.ustring.gsub(mw.ustring.gsub(rank,'^ichno',''),'^oo','') ifbaseRank=='rdo'thenbaseRank='ordo'end -- if an "ichno" or "oo" rank, lower rank value slightly so it is ok below the base rank rankVal=rankValTable[baseRank] ifrankValthen rankVal=rankVal-0.1 end end returnrankVal end --[[=========================== hasRankVal ================================= Utility function to determine whether the rank has a value in rank value table. Returns 'yes' or 'no'. =============================================================================]] functionl.hasRankVal(rank) ifrank==''thenreturn'no'end localrankVal=p.lookupRankVal(rank) ifnotrankValthenrankVal='no'elserankVal='yes'end returnrankVal end --[[========================== showRankTable ================================ Returns a wikitable showing the ranks and their values as set up in the constant rankValTable. Usage: {{#invoke:Taxobox ranks|showRankTable}} =============================================================================]] functionp.showRankTable(frame) localres='{| class="wikitable sortable"\n|+ Peringkat diperiksa dalam templat taksonomi\n! Peringkat !! Ditampilkan sebagai !! Nilai\n' fork,vinpairs(rankValTable)do localrankShown=p.doAngliciseRank(k,'no') res=res..TableRow..'|'..k..'||'..rankShown..'||'..v..'\n' end returnres..TableEnd end returnp