模块:Autotaxobox/doc
这是Module:Autotaxobox的文档页面
| 此模块文档被引用于约187,000个页面,占全部页面的2%。 为了避免造成大规模的影响,所有对此模块文档的编辑应先于沙盒或测试样例上测试。实施修改前,建议先在讨论页发起讨论。 模板引用数量会自动更新。 |
| 此模块文档已被保护。此高度可见模块文档具有高风险,或已用于大量页面或被频繁替换引用。由于破坏或失误影响程度严重,因此已被保护,只有错误:页面未被保护。可以编辑。 |
| 此模块使用Lua语言: |
Module:Autotaxobox (讨论 · · 历史 · 链接 · 文档 · 子页面 · 沙盒 · 测试用例)
本模块旨在为自动生物分类框系统(包括{{Speciesbox}}与{{Automatic taxobox}}等模板)提供支持,以避免在遍历分类学模板中编码的分类阶元层级时触发MediaWiki模板展开深度错误。
目前,系统处理被限定为至多支持包含100个层级的分类体系。
有关该模块内各函数在系统中的具体调用与运作方式,请参见自动生物分类框系统结构图。
taxoboxColour
[编辑]在给定分类单元名称的情况下,此函数用于返回该分类单元在自动生物分类框中所对应的正确颜色。其实现方式是沿着分类阶元层级向上检索设定了生物信息框颜色的“真实”分类单元(即非地位未定(incertae sedis)分类单元),并返回该颜色。若未检索到“真实”分类单元,但在层级中存在地位未定分类单元,则返回incertae sedis对应的颜色;否则返回“transparent”(透明)。(若分类层级过深而超出处理限制,则返回错误提示颜色。)
用法:
{{#invoke:Autotaxobox|taxoboxColour|taxon_name}}
参数:
- 该匿名参数应为已存在“Template:Taxonomy/taxon_name”页面的分类单元名称。
示例:
{{#invoke:Autotaxobox|taxoboxColour|Felis}}→ rgb(235,235,210){{#invoke:Autotaxobox|taxoboxColour|Acacia}}→ rgb(180,250,180)
taxoboxList
[编辑]给定一个分类单元的名称,该函数会根据所提供分类单元的分类学层级,返回自动生物分类框中的分类单元行。如果生物分类框中所显示的最低级分类单元低于属,则所提供的分类单元通常会高于生物分类框的目标分类单元,因此需要将偏移量计算在内。
用法
[编辑]{{#invoke:Autotaxobox|taxoboxList
| <!-- the name of taxon upwards from which the taxonomic hierarchy is to be displayed by this function -->
|display_taxa = <!-- the number of taxa above taxon to force to be displayed -->
|authority = <!-- taxonomic authority for the lowest level taxon in the taxobox (the taxobox_target) (see also offset below) -->
|parent_authority = <!-- taxonomic authority for taxobox_target's parent -->
|gparent_authority = <!-- taxonomic authority for taxobox_target's grandparent -->
|ggparent_authority = <!-- taxonomic authority for taxobox_target's greatgrandparent -->
|gggparent_authority = <!-- taxonomic authority for taxobox_target's greatgreatgrandparent -->
|bold_first = <!-- bold to embolden taxon in its row -->
|offset = <!-- the offset of taxon from taxobox_target – the number of steps from taxobox_target to taxon -->
}}
参数
[编辑]匿名参数应为已存在“Template:Taxonomy/taxon_name”页面的分类单元名称,其余参数已在上方作过解释。
示例
[编辑]{| class="wikitable"
{{#invoke:Autotaxobox|taxoboxList|Felis|authority=Linnaeus, 1758}}
|}
|
→ |
|
taxonomyList
[编辑]在给定分类单元名称的情况下,此函数会根据所提供分类单元名称对应的分类学层级,返回显示在“Template:Taxonomy/taxon_name”页面上的分类学表格各行。
当向下遍历分类学层级时,若检测到某个阶元处于与此前已遍历阶元相同或更高的级别(例如在亚科下方出现了科),则显示该阶元的单元格将呈现浅红色背景;若该异常阶元即为所提供的分类单元,对应页面将被归入追踪分类 Category:显示不规则层级的分类学模板。在getRankTable()中定义的数值用于确定阶元的正确顺序。未在该表中定义数值的阶元不会对其顺序进行检查。
用法
[编辑]{{#invoke:Autotaxobox|taxonomyList|taxon_name}}
参数
[编辑]- 匿名参数应为已存在“Template:Taxonomy/taxon_name”页面的分类单元名称。
| 标记 | {{#invoke:Autotaxobox|taxonomyList|Felis}} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 渲染为 | 粗体层级代表主要层级或者已被设置
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
callTaxonomyKey
[编辑]此函数用于整理所需数据并调用{{Taxonomy key}}以呈现分类学模板页面(该模板进而会调用本模块的taxonomyList函数)。其运作机制是汇集该模板所需的各项信息,若存在 same_as链接则予以追踪解析,随后执行模板调用。
本函数由{{Don't edit this line}}使用。
用法:
{{#invoke:Autotaxobox|callTaxonomyKey
|taxon=
|parent=
|rank=
|extinct=
|always_display=
|link_target=分类学模板中 'link' 参数的值
|link_text=分类学模板中匿名参数的值
|refs=
|same_as=
}}
showRefs
[编辑]用于显示分类学模板中的refs(参考文献)字段,能够处理地位未定(incertae sedis)的分类单元,并在缺失参考文献信息时显示“–”。
用法
[编辑]{{#invoke:Autotaxobox|showRefs|taxon_name|refs}}
示例
[编辑]{{#invoke:Autotaxobox|showRefs|Neoscona|{{Taxon info|Neoscona|refs}}}}→ –{{#invoke:Autotaxobox|showRefs|Incertae sedis/Characidae|}}→ not applicable (incertae sedis)
taxonLink
[编辑]返回指向分类单元的维基链接;根据需要,可在其前方添加“†”、后方添加“ (?)”,亦可选择将其设为斜体,或设为加粗且不生成维基链接。该函数可通过{{Taxon link}}在外部调用。在特定情况下,部分参数可以省略。
用法
[编辑]{{#invoke:Autotaxobox|taxonLink
|taxon= <!-- having '/?' at the end triggers the output of ' (?)' -->
|extinct= <!-- 'yes' or 'true' triggers the output of '†' -->
|bold= <!-- 'yes' makes the core output bold and not wikilinked -->
|italic= <!-- 'yes' makes the core output italic -->
|link_target= <!-- target for the wikilink -->
|plain_link_text= <!-- text of the wikilink (without †, italics, etc.) -->
}}
示例
[编辑]{{#invoke:Autotaxobox|taxonLink|taxon=Felis|italic=yes}}→ Felis{{#invoke:Autotaxobox|taxonLink|taxon=Incertae sedis/Animalia}}→ 地位未定 incertae sedis{{#invoke:Autotaxobox|taxonLink|link_target=Pterosaur|plain_link_text=Pterosauromorpha|extinct=yes}}→ †Pterosauromorpha{{#invoke:Autotaxobox|taxonLink|taxon=Dinosauria/?|link_target=Dinosaur|plain_link_text=Dinosauria|extinct=yes}}→ †Dinosauria (?)
taxonInfo
[编辑]在给定分类单元名称及存储于该分类单元分类学模板中所需信息项名称的情况下,此函数用于返回该项信息的值;若该值为空字符串且存在可用的“same as”链接,则会追踪并解析一条该链接以获取对应值。
用法:
{{#invoke:Autotaxobox|taxonInfo|taxon_name|item_name}}
参数:
- 第一个匿名参数应为已存在“Template:Taxonomy/taxon_name”页面的分类单元名称。
- 第二个匿名参数的可选值详见{{Taxon info/doc}}。
示例:
{{#invoke:Autotaxobox|taxonInfo|Felis|rank}}→ genus{{#invoke:Autotaxobox|taxonInfo|Aves/skip|same_as}}→ Aves{{#invoke:Autotaxobox|taxonInfo|Aves/skip|parent}}→ Chordata
实用工具
[编辑]这些函数仅用于分析和理解自动生物分类框系统,包括编码于分类学模板中的分类层级——例如在测试和调试时使用。它们并非自动生物分类框系统常规运作功能的一部分。
getMaxSearchLevels
[编辑]返回系统在检索分类学模板所编码的分类层级时,所能遍历的最大层级数。
用法:
{{#invoke:Autotaxobox|getMaxSearchLevels}}→ 100
find
[编辑]在给定分类单元名称与阶元的情况下,此函数返回该分类单元在指定阶元上的祖先分类单元。
用法:
{{#invoke:Autotaxobox|find|taxon_name|rank}}
参数:
- 第一个匿名参数应为已存在“Template:Taxonomy/taxon_name”页面的分类单元名称。
- 第二个匿名参数应为阶元的拉丁化名称。
示例:
{{#invoke:Autotaxobox|find|Felis|ordo}}→ Carnivora{{#invoke:Autotaxobox|find|Felis|classis}}→ Mammalia/skip{{#invoke:Autotaxobox|find|Pteranodon|phylum}}→ Chordata{{#invoke:Autotaxobox|find|Pteranodon|classis}}→ Sauropsida
nth
[编辑]在给定分类单元名称的情况下,此函数返回分类层级中其上方的第 n 个分类单元。
用法:
{{#invoke:Autotaxobox|nth|taxon_name}}
参数:
- 匿名参数应为已存在“Template:Taxonomy/taxon_name”页面的分类单元名称。
- n 为所需查找的分类单元所在的上级层级数。
示例:
{{#invoke:Autotaxobox|nth|Felis}}→ Felis{{#invoke:Autotaxobox|nth|Felis}}→ Laurasiatheria
nLevels
[编辑]在给定分类单元名称的情况下,此函数返回分类层级中该分类单元及其上方的总层级数。
用法:
{{#invoke:Autotaxobox|nLevels|taxon_name}}
参数:
- 匿名参数应为已存在“Template:Taxonomy/taxon_name”页面的分类单元名称。
示例:
{{#invoke:Autotaxobox|nLevels|Felis}}→ 42{{#invoke:Autotaxobox|nLevels|Pteranodon}}→ 51
listAll
[编辑]在给定分类单元名称的情况下,此函数以逗号分隔的列表形式返回分类层级中该分类单元及其上方的所有层级。
用法:
{{#invoke:Autotaxobox|listAll|taxon_name}}
参数:
- 匿名参数应为已存在“Template:Taxonomy/taxon_name”页面的分类单元名称。
示例:
{{#invoke:Autotaxobox|listAll|Plantae}}→ Plantae-regnum, Archaeplastida-cladus, CAM-cladus, Diaphoretickes-cladus, Eukaryota-domain, Life-{{#invoke:Autotaxobox|listAll|Felis}}→ Felis-genus, Felinae-subfamilia, Pseudaelurus/grade-grade, Felidae-familia, Feloidea-superfamilia, Aeluroidea-infraordo, Feliformia-subordo, Carnivora-ordo, Carnivoraformes-cladus, Carnivoramorpha-cladus, Pan-Carnivora-cladus, Ferae-mirordo-mb, Ferungulata-grandordo-mb, Scrotifera-cladus, Laurasiatheria-superordo, Boreoeutheria-magnordo, Placentalia-cladus, Eutheria-infraclassis, Theria-subclassis, Tribosphenida-cladus, Zatheria-cladus, Prototribosphenida-cladus, Cladotheria-cladus, Trechnotheria-cladus, Theriiformes-cladus, Theriimorpha-cladus, Mammalia/skip-classis, Chordata-phylum, Deuterostomia-superphylum, Nephrozoa-cladus, Bilateria-cladus, ParaHoxozoa-cladus, Eumetazoa-subregnum, Animalia-regnum, Choanozoa-cladus, Filozoa-cladus, Holozoa-superregnum, Opisthokonta-cladus, Obazoa-cladus, Amorphea-cladus, Eukaryota-domain, Life-
removeQualifier
[编辑]在给定分类单元名称的情况下,此函数返回去除了任何限定符(即“/”之后的任何部分)的名称。
用法:
{{#invoke:Autotaxobox|removeQualifier|taxon_name}}
示例:
{{#invoke:Autotaxobox|removeQualifier|Eukaryota/display}}→ Eukaryota{{#invoke:Autotaxobox|removeQualifier|Felis}}→ Felis