Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Module:Taxobox ranks

Permanently protected module
From Wikipedia, the free encyclopedia
Module documentation[view] [edit] [history] [purge]
WarningThis Lua module is used onapproximately 606,000 pages, or roughly 1% of all pages.
To avoid major disruption and server load, any changes should be tested in the module's/sandbox or/testcases subpages, or in your ownmodule sandbox. The tested changes can be added to this page in a single edit. Consider discussing changes on thetalk page before implementing them.
Ready for useThis module is rated asready for general use. It has reached a mature form and is thought to be relatively bug-free and ready for use wherever appropriate. It is ready to mention on help pages and other Wikipedia resources as an option for new users to learn. To reduce server load and bad output, it should be improved bysandbox testing rather than repeated trial-and-error editing.
ProtectedThis module issubject to page protection. It is ahighly visible module in use by a very large number of pages, or issubstituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it isprotected from editing.

Module:Taxobox ranks(talk ·edit ·hist ·links ·doc ·sandbox ·testcases)

This module provides support to theautomated taxobox system – templates such as{{Automatic taxobox}} or{{Speciesbox}}. Part of it also supports manual taxoboxes.

It defines:

  • The rank names that are acceptable and the way they are displayed in English.
  • For a subset of the rank names, it defines arbitrary numerical values that are used to check the consistent ordering of ranks in a taxonomic hierarchy.

It is thus part of the configuration of taxoboxes and taxonomy templates.

To add a new rank

To add a new rank, edit the table that defines the local variableranks in this module. The rank name should be in Latin, where a Latin version exists, and should be all lower-case. The equivalent English name should be capitalised. 'Special cases' have italicized English names. The complete table can be seen atModule:Taxobox ranks/testcases#Anglicised rank names.

Some ranks should always be checked for consistent rank ordering in a taxonomic hierarchy. For example, a genus must not occur above a family, and a family must not occur above an order. If the new rank is one that should always be checked in this way, then edit the table that defines the local variablerankValTable in this module. Use the table atModule:Taxobox ranks/testcases#Rank values to decide on a numerical value to be assigned to the rank to ensure correct ordering.

Usage

FunctionsangliciseRank andlookupRankVal are used in the automated taxobox system to access the two tables defined in this module.{{Anglicise rank}} provides a template interface toangliciseRank. These functions are not intended for use outside the automated taxobox system.

A table containing all the ranks defined in the module can be displayed via{{#invoke:Taxobox ranks|showRanks}}.

A table containing all the rank values defined in the module can be displayed via{{#invoke:Taxobox ranks|showRankTable}}.

See also

Further rank configuration for the automated taxobox system includes:

  • {{Principal rank}} – defines the Linnaean principal ranks that are shown by default in automated taxoboxes
  • {{Is italic taxon}} – defines which ranks cause taxon names to be italicized in automated taxoboxes
The abovedocumentation istranscluded fromModule:Taxobox ranks/doc.(edit |history)
Editors can experiment in this module'ssandbox(edit |diff) andtestcases(edit) pages.
Subpages of this module.

--[[*************************************************************************This module provides support to the automated taxobox system – the templatesAutomatic taxobox, Speciesbox, Subspeciesbox, Infraspeciesbox, etc.In particular it is part of the configuration of the system, defining therank names that are recognized and the way they are displayed in English intaxoboxes and viewed taxonomy templates.*****************************************************************************]]require('strict')localTableRow='|-\n'localTableEnd='|}\n'localp={}-- functions made publiclocall={}-- internal functions, kept separate--*************************** CONFIGURATION *********************************--[[============================ ranks ======================================Set up a constant to hold the rank names and their English equivalents.If adding to this list, note that rank names containing spaces or - must beenclosed in [' '].=============================================================================]]localranks={--Special cases, alphabetic orderalliance='<i>Alliance</i>',['basic shell type']='<i>Basic shell type</i>',branch='<i>Branch</i>',clade='<i>Clade</i>',cladus='<i>Clade</i>',['form taxon']='<i>Form taxon</i>',grade='<i>Grade</i>',gradus='<i>Grade</i>',informal='<i>Informal group</i>',['informal group']='<i>Informal group</i>',morphotype='<i>Morphotype</i>',node='<i>Node</i>',plesion='<i>Plesion</i>',['plesion-group']='<i>Plesion-group</i>',['possible clade']='<i>Clade?</i>',['species complex']='<i>Species complex</i>',['species group']='<i>Species group</i>',['species subgroup']='<i>Species subgroup</i>',['stem group']='<i>Stem group</i>',['total group']='<i>Total group</i>',--Special virus ranksrealm='Realm',serotype='Serotype',strain='Strain',virus='Virus',['virus group']='Group',--Linnaean taxonomy, alphabetic orderclassis='Class',cohort='Cohort',divisio='Division',domain='Domain',epifamilia='Epifamily',familia='Family',forma='Form',genus='Genus',grandordo='Grandorder',['grandordo-mb']='Grandorder',--McKenna & Bell versionhyperfamilia='Hyperfamily',infraclassis='Infraclass',infralegio='Infralegion',infralegion='Infralegion',infraordo='Infraorder',infraphylum='Infraphylum',infraregnum='Infrakingdom',infratribus='Infratribe',legio='Legion',legion='Legion',magnordo='Magnorder',micrordo='Microrder',microphylum='Microphylum',mirordo='Mirorder',['mirordo-mb']='Mirorder',--McKenna & Bell versionnanordo='Nanorder',nanophylum='Nanophylum',ordo='Order',parafamilia='Parafamily',parvclassis='Parvclass',parvordo='Parvorder',phylum='Phylum',regnum='Kingdom',sectio='Section',series='Series',species='Species',subclassis='Subclass',subcohort='Subcohort',subdivisio='Subdivision',subfamilia='Subfamily',subgenus='Subgenus',sublegio='Sublegion',sublegion='Sublegion',subordo='Suborder',subphylum='Subphylum',subregnum='Subkingdom',subsectio='Subsection',subseries='Subseries',subspecies='Subspecies',subterclassis='Subterclass',--used in WoRMSsubtribus='Subtribe',superclassis='Superclass',supercohort='Supercohort',superdivisio='Superdivision',superdomain='Superdomain',superfamilia='Superfamily',superlegio='Superlegion',superlegion='Superlegion',superordo='Superorder',superphylum='Superphylum',superregnum='Superkingdom',supersectio='Supersection',supertribus='Supertribe',tribus='Tribe',varietas='Variety',zoodivisio='Division',zoosectio='Section',zooseries='Series',zoosubdivisio='Subdivision',zoosubsectio='Subsection',--trace fossil taxonomy, alphabetic order-->',ichnoclassis='Ichnoclass',ichnocohort='Ichnocohort',ichnodivisio='Ichnodivision',ichnofamilia='Ichnofamily',ichnogenus='Ichnogenus',ichnograndordo='Ichnograndorder',['ichnograndordo-mb']='Ichnograndorder',--McKenna & Bell versionichnoinfraclassis='Ichnoinfraclass',ichnoinfradivisio='Ichnoinfradivision',ichnoinfraordo='Ichnoinfraorder',ichnolegio='Ichnolegion',ichnolegion='Ichnolegion',ichnomagnordo='Ichnomagnorder',ichnomicrordo='Ichnomicrorder',ichnoordo='Ichnoorder',ichnoparvordo='Ichnoparvorder',ichnospecies='Ichnospecies',['ichnostem-group']='Ichnostem-Group',ichnosubclassis='Ichnosubclass',ichnosubdivisio='Ichnosubdivision',ichnosubfamilia='Ichnosubfamily',ichnosublegio='Ichnosublegion',ichnosublegion='Ichnosublegion',ichnosubordo='Ichnosuborder',ichnosuperclassis='Ichnosuperclass',ichnosupercohort='Ichnosupercohort',ichnosuperfamilia='Ichnosuperfamily',ichnosuperordo='Ichnosuperorder',--fossilized egg taxonomy, alphabetic orderooclassis='Ooclass',oocohort='Oocohort',oofamilia='Oofamily',oogenus='Oogenus',oomagnordo='Oomagnorder',oordo='Oorder',oospecies='Oospecies',oosubclassis='Oosubclass',oosubgenus='Oosubgenus',oosubspecies='Oosubspecies',oosupercohort='Oosupercohort',oosuperordo='Oosuperorder',}--[[========================== rank values===================================Constant to set up a table of numerical values correspondingto 'Linnaean' ranks, with upper ranks having higher values. In a validtaxonomic hierarchy, a lower rank should never have a higher value than ahigher rank. The actual numerical values are arbitrary so long as they areordered.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 subterclassisparvordo=996,phylum=1500,regnum=1600,sectio=500,--series = 400, used too inconsistently to checkspecies=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 parvclassissubtribus=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 taxonomytemplate.If the rank name is not in the table of ranks, then the first letterof the rank name is capitalized and used as the English name.If checked=yes, then the generated English name is highlighted in red. Ifcalled from a taxonomy template, the page is put inCategory: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~=rankNameifwasCapitalizedthenrankName=testNameend-- try uncapitalized versionifstring.sub(rankName,1,8)=='unranked'thenreturn'(unranked)'end-- now look for an English version of the rank namelocalres=ranks[rankName]localnotFound=notresifnotFoundthen--rankName is not in the table of recognized ranks; just capitalize rankNameres=string.upper(string.sub(rankName,1,1))..string.sub(rankName,2)endifcheck=='no'thenreturnreselseifnotFoundthenres='<span>'..res..'</span>'-- highlight returned English nameend-- tracking caegories required only if called from a taxonomy templatelocalpageTitle=mw.title.getCurrentTitle()ifpageTitle.nsText=='Template'andpageTitle.rootText=='Taxonomy'thenifnotFoundthenres=res..'[[Category:Taxonomy templates using unrecognized rank parameters]]'elseifwasCapitalizedthenres=res..'[[Category:Taxonomy templates using capitalized rank parameters]]'endendreturnresendfunctionp.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 intaxoboxes, whether they are automatically italicized, and whether they arechecked for consistency of rank order.Usage: {{#invoke:Taxobox ranks|showRanks}}=============================================================================]]functionp.showRanks(frame)localres='{|\n'res=res..'|+ Ranks recognized in taxonomy templates\n'res=res..'!style="text-align: left;"|Rank name in<br/>taxonomy<br/>template'res=res..'!!style="text-align: left;"|Shown in<br/>taxobox as'res=res..'!! |Taxon name<br/>automatically<br/>italicized?'res=res..'!! |Rank checked<br/>for consistent<br/>order?'res=res..'\n'fork,tinpairs(ranks)dores=res..TableRow..'|'..k..'||'..t..'||'..frame:expandTemplate{title='Is italic taxon',args={k}}..'||'..l.hasRankVal(k)..'\n'endreturnres..TableEndend--************************* Process rank values *****************************--[[========================= lookupRankVal =================================Function to look up the arbitrary numerical value of a rank in a rank valuetable. "Ichno" and "oo" ranks are not stored separately, so if present theprefix 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 rankrankVal=rankValTable[baseRank]ifrankValthenrankVal=rankVal-0.1endendreturnrankValend--[[=========================== hasRankVal =================================Utility function to determine whether the rank has a value in rank valuetable. Returns 'yes' or 'no'.=============================================================================]]functionl.hasRankVal(rank)ifrank==''thenreturn'no'endlocalrankVal=p.lookupRankVal(rank)ifnotrankValthenrankVal='no'elserankVal='yes'endreturnrankValend--[[========================== showRankTable ================================Returns a wikitable showing the ranks and their values as set up in theconstant rankValTable.Usage: {{#invoke:Taxobox ranks|showRankTable}}=============================================================================]]functionp.showRankTable(frame)localres='{|\n|+ Ranks checked in taxonomy templates\n! Rank !! Shown as !! Value\n'fork,vinpairs(rankValTable)dolocalrankShown=p.doAngliciseRank(k,'no')res=res..TableRow..'|'..k..'||'..rankShown..'||'..v..'\n'endreturnres..TableEndendreturnp
Retrieved from "https://en.wikipedia.org/w/index.php?title=Module:Taxobox_ranks&oldid=1290605270"
Category:
Hidden category:

[8]ページ先頭

©2009-2025 Movatter.jp