# Module:Autotaxobox/doc



Module:Autotaxobox  

The purpose of this module is to provide support for automated taxobox templates (such as or ), avoiding Mediawiki template expansion depth errors in the traversal of the taxonomic hierarchies encoded in taxonomy templates.  

Currently processing is arbitrarily limited to hierarchies containing at most levels.  

## taxoboxColour
Given a taxon name, this function returns the correct colour of an automated taxobox for that taxon. It does so by searching up the taxonomic hierarchy for a 'real' taxon (i.e. not *incertae sedis*) that sets the taxobox colour, and then returning that colour. If no 'real' taxon is found, then if an *incertae sedis* taxon was found, the *incertae sedis* colour is returned, otherwise "transparent" is returned. (If the taxonomic hierarchy is too deep to process, the error colour is returned.)  

Usage:  

:<code>#invoke:Autotaxobox|taxoboxColour|*taxon_name*}}</code>  

Parameters:  

:The unnamed parameter should be the name of a taxon for which "Template:Taxonomy/*taxon_name*" exists.  

Examples:  

: →  
: →  

## taxoboxList
Given a taxon name, this function returns the rows of taxa in an automated taxobox, based on the taxonomic  
hierarchy for the supplied taxon.  

Usage:  

<code>#invoke:Autotaxobox|taxoboxList|*taxon_name*  

|display_taxa = *the number of taxa above taxon_name to force to be displayed*  

|authority = *taxonomic authority for taxon_name*  

|parent_authority = *taxonomic authority for taxon_name's parent*  

|gparent_authority = *taxonomic authority for taxon_name's grandparent*  

|ggparent_authority = *taxonomic authority for taxon_name's greatgrandparent*  

|ggparent_authority = *taxonomic authority for taxon_name's greatgreatgrandparent*  

|bold_first = *bold to embolden taxon_name in its row*  

}}</code>  

Parameters:  

:The unnamed parameter should be the name of a taxon for which "Template:Taxonomy/*taxon_name*" exists. The others are explained above.  

Examples:  

<pre>{|  

|}</pre> →  

## taxonomyList
Given a taxon name, this function returns the rows of the taxonomy table displayed on the "Template:Taxonomy/*taxon_name*" page, based on the taxonomic hierarchy for the supplied taxon name.  

When <em>descending</em> the taxonomic hierarchy, if a rank is found that is either at the same level or higher than a rank already encountered (e.g. a family is found below a subfamily), the cell displaying the rank is given a reddish background. The numerical values defined in <code>getRankTable</code> are used to determine the correct sequence of ranks.  

Usage:  

:<code>#invoke:Autotaxobox|taxonomyList|*taxon_name*}}</code>  

Parameters:  

:The unnamed parameter should be the name of a taxon for which "Template:Taxonomy/*taxon_name*" exists.  

Examples:  
<pre>{|  

|}</pre> →  

## callTaxonomyKey
This function prepares for, and then calls, to display a taxonomy  
template page. It does this by building up the information the template  
requires, following one <code>same_as</code> link if present, and then calling it.  

Usage:  

<code>#invoke:Autotaxobox|callTaxonomyKey  
|parent=  

|rank=  

|extinct=  

|always_display=  

|link_target=value of 'link' parameter in the taxonomy template  

|link_text=value of unnamed parameter in the taxonomy template  

|same_as=  

}}</code>  

## taxonInfo
Given the names of a taxon and the required item of information stored in the taxon's taxonomy template, this function returns the value of the item, following one "same as" link if available and the value would otherwise be the empty string. The function would normally be used externally via .  

Usage:  

:<code>#invoke:Autotaxobox|taxonInfo|*taxon_name*|*item_name*}}</code>  

Parameters:  

:The first unnamed parameter should be the name of a taxon for which "Template:Taxonomy/*taxon_name*" exists.  
:The possible values of the second unnamed parameter are given at .  

Examples:  

: →  
: →  
: →  

## taxonLink
Returns a wikilink to a taxon, if required including '†' before it and  
' (?)' after it, and optionally italicized or bolded without a wikilink.  
It would normally be used via . Some parameters can, under  
some circumstances, be omitted.  

Usage:  

<code>#invoke:Autotaxobox|taxonLink  

|taxon= </code>(having '/?' at the end triggers the output of ' (?)')<code>  

|extinct= </code>('yes' or 'true' trigger the output of '†')<code>  

|bold= </code>('yes' makes the core output bold and not wikilinked)<code>  

|italic= </code>('yes' makes the core output italic)<code>  

|link_target=*target for the wikilink*  

|plain_link_text= *text of the wikilink* </code>(without †, italics, etc.)<code>  

}}</code>  

Examples:  

: →  
: →  
: →  
: →  

## showRankTable
Returns a sortable wikitable containing the ranks and corresponding numerical values defined in <code>getRankTable</code> and used in checking the consistency of a taxonomic hierarchy. If a taxon has a value in the rank table, it should always be lower than one higher in the taxonomic hierarchy.  

Usage:  

:<code>#invoke:Autotaxobox|showRankTable}}</code>  

## Utilities
These functions are intended to be used only in analysing taxonomic hierarchies, e.g. in testing and debugging, and not for direct use in templates used in the automated taxobox system.  

### nth
Given a taxon name, this function returns the *n*th taxon above it in the taxonomic hierarchy.  

Usage:  

:<code>#invoke:Autotaxobox|nth|*taxon_name*|n=*integer*}}</code>  

Parameters:  

:The unnamed parameter should be the name of a taxon for which "Template:Taxonomy/*taxon_name*" exists.  
:**n** is the level whose taxon is to be found  

Examples:  

: →  
: →  

### nLevels
Given a taxon name, this function returns the number of levels at and above it in the taxonomic hierarchy.  

Usage:  

:<code>#invoke:Autotaxobox|nLevels|*taxon_name*}}</code>  

Parameters:  

:The unnamed parameter should be the name of a taxon for which "Template:Taxonomy/*taxon_name*" exists.  

Examples:  

: →  
: →  

### listAll
Given a taxon name, this function returns a comma-separated list of all the levels at and above it in the taxonomic hierarchy.  

Usage:  

:<code>#invoke:Autotaxobox|listAll|*taxon_name*}}</code>  

Parameters:  

:The unnamed parameter should be the name of a taxon for which "Template:Taxonomy/*taxon_name*" exists.  

Examples:  

: →  
: →  

<includeonly></includeonly>