Module:Autovirusbox
Appearance
![]() | This Lua module is used on many pages and changes may be widely noticed. Test changes in the module's /sandbox or /testcases subpages, or in your own module sandbox. Consider discussing changes on the talk page before implementing them. |
![]() | This module depends on the following other modules: |
Uses the following templates:
- Template:Children rank
- Template:Is italic taxon
- Template:Main other
- Template:Taxobox colour
- Template:Taxobox/core
- Template:Taxon info
Usage
This module implements the function of {{Virusbox}} – see that template's documentation for details and parameters.
It can be called via {{Virusbox |...}}
, or directly, in which case |direct=yes
must be supplied, i.e. {{#invoke:Autovirusbox|main |direct=yes |...}}
.
--[[
<noinclude><!--
-==================================================================
- Template:Virusbox - Show taxobox by {Taxobox/core} for a virus
-==================================================================
--
-- This template sends parameters to Taxobox/core, which shows a
-- right-side infobox. Most parameters are just passed directly;
-- while some parameters are noted with a comment.
--
-- Check for the existence of the required taxonomy template
--></noinclude>{{#ifexist:Template:Taxonomy/{{#switch:{{Virusbox/parameter chk|{{{taxon|}}}|{{{parent|}}}|{{{species|}}}|{{{serotype|{{{strain|{{{virus|}}}}}}}}}}}
|TAXON={{{taxon}}}|PARENT={{{parent}}}|ERROR=<noinclude>Orthonairovirus</noinclude>}}
|<noinclude><!--do nothing if it exists--></noinclude>|{{Automatic taxobox/floating intro|taxon={{{taxon}}}}}}}<!-- ITALIC TITLE: should the page title be in italics?
-->{{#switch:{{PAGENAMEBASE}}
|{{{taxon|}}}={{#ifeq:{{Is italic taxon|{{Taxon info|{{{taxon}}}|rank}}|virus=yes}}|yes|{{italic title}}}}
|{{{parent|}}}={{#ifeq:{{Is italic taxon|{{Taxon info|{{{parent}}}|rank}}|virus=yes}}|yes|{{italic title}}}}
|{{{species|}}}={{italic title}}
}}<noinclude><!--
--
-- The nowiki that follows is needed because of parser bug T18700.
--
--></noinclude><includeonly><nowiki/>{{Taxobox/core/sandbox
| virus = yes
| edit link = {{{edit link|{{{edit_link|e}}} }}}<!--
--
-- COLOUR: (note the UK spelling here) generated by Template:Taxobox colour, always for viruses in this case.
-->
| colour = {{taxobox color|virus}}
| classification_status = {{{classification status|{{{classification_status|}}} }}}<!--
--
-- NAME: the name parameter is intended only for cases where the taxobox name does not
-- match that displayed or linked to by the taxon in question.
-->
| name = {{#switch:{{Virusbox/parameter chk|{{{taxon|}}}|{{{parent|}}}|{{{species|}}}|{{{serotype|{{{strain|{{{virus|}}}}}}}}}}}<!--
-->|TAXON={{#ifeq:{{Is italic taxon|{{taxon info|{{{taxon}}}|rank}}|virus=yes}}|yes|''{{{taxon}}}''|{{{taxon}}}}}<!--
-->|PARENT={{{serotype|{{{strain|{{{virus|''{{{species|}}}''}}}}}}}}}<!--
-->|{{error|ERROR: parameter(s) specifying taxon are incorrect; see §§Template:Virusbox/doc#Usage|documentation§§}}}}<!--
--
-- PARENT: the entry point to the hierarchy of taxonomy templates; it ought really be called "taxon", not "parent".
-->
| parent = {{#switch:{{Virusbox/parameter chk|{{{taxon|}}}|{{{parent|}}}|{{{species|}}}|{{{serotype|{{{strain|{{{virus|}}}}}}}}}|{{{serotype|{{{strain|{{{virus|}}}}}}}}}}}
|TAXON={{{taxon|}}}|PARENT={{{parent|}}}}}<!--
--
-- DISPLAY TAXA: number of immediate parents to display. Defaults to 1 to give the taxon some context.
-->
| display_taxa = {{{display parents|{{{display_parents|1}}}}}}
| authority = {{{authority|}}}
| parent_authority = {{{parent authority|{{{parent_authority|}}} }}}
| grandparent_authority = {{{grandparent authority|{{{grandparent_authority|}}} }}}
| greatgrandparent_authority = {{{greatgrandparent authority|{{{greatgrandparent_authority|}}} }}}
| greatgreatgrandparent_authority = {{{greatgreatgrandparent authority|{{{greatgreatgrandparent_authority|}}} }}}
| image = {{{image|}}}
| image_width = {{{image_width|{{{image width|}}} }}}
| image_alt = {{{image alt|{{{image_alt|}}} }}}
| image_caption = {{{image caption|{{{image_caption|}}} }}}
| image2 = {{{image2|}}}
| image2_width = {{{image2 width|{{{image2_width|}}} }}}
| image2_alt = {{{image2 alt|{{{image2_alt|}}}}}}
| image2_caption = {{{image2 caption|{{{image2_caption|}}}}}}
| type_genus = {{{type genus|{{{type_genus|}}}}}}
| type_genus_authority = {{{type genus authority|{{{type_genus_authority|}}} }}}
| type_species = {{{type species|{{{type_species|}}} }}}
| type_species_authority = {{{type species authority|{{{type_species_authority|}}} }}}
| species = {{#if:{{{species|}}}|{{#if:{{{serotype|{{{strain|{{{virus|}}}}}}}}}|''{{{species}}}''|'''''{{{species}}}'''''}}}}
| virus_infrasp = {{#if:{{{serotype|{{{strain|{{{virus|}}}}}}}}}|'''{{{serotype|{{{strain|{{{virus|}}}}}}}}}'''}}
| virus_infrasp_rank = {{#if:{{{serotype|}}}|serotype<!--
-->|{{#if:{{{strain|}}}|strain<!--
-->|{{#if:{{{virus|}}}|virus}}}}}}<!--
-- SUBDIVISION RANKS: displayed above the subdivision, and generated automatically from the taxon's rank if unspecified.
-->
| subdivision_ranks = {{{subdivision ranks|{{{subdivision_ranks|{{children_rank|{{Taxon info|{{{taxon}}}|rank}} }} }}} }}}
| subdivision = {{{subdivision|}}}
| type_strain = {{{type strain|{{{type_strain|}}} }}}
| synonyms = {{{synonyms|}}}
| synonyms_ref = {{{synonyms ref|{{{synonyms_ref|}}} }}}
| range_map = {{{range map|{{{range_map|}}} }}}
| range_map_width = {{{range map width|{{{range_map_width|}}} }}}
| range_map_alt = {{{range map alt|{{{range_map_alt|}}} }}}
| range_map_caption = {{{range map caption|{{{range_map_caption|}}} }}}
}}{{#switch:{{Virusbox/parameter chk|{{{taxon|}}}|{{{parent|}}}|{{{species|}}}|{{{serotype|{{{strain|{{{virus|}}}}}}}}}}}
|ERROR={{main other|§§Category:Virusboxes with incorrect parameters that specify taxon§§}}}}</includeonly><noinclude>
{{documentation}}</noinclude>
]]
require('Module:No globals')
local p = {} -- functions made public
local l = {} -- internal functions, kept separate
function p.main(frame)
local taxon = frame.args['taxon'] or ''
local parent = frame.args['parent'] or ''
local species = frame.args['species'] or ''
local serotype = frame.args['serotype'] or ''
local virus = frame.args['virus'] or ''
local display_parents = frame.args['display_parents'] or ''
--[[
local authority = frame.args['authority'] or ''
local parentAuthority = frame.args['parent_authority'] or ''
local gParentAuthority = frame.args['grandparent_authority'] or ''
local ggParentAuthority = frame.args['greatgrandparent_authority'] or ''
local gggParentAuthority = frame.args['greatgreatgrandparent_authority'] or ''
local typeGenusAuthority = frame.args['type_genus_authority'] or ''
]]
local subdivisionRanks = frame.args['subdivision_ranks'] or ''
--[[
| subdivision_ranks = {{{subdivision ranks|{{{subdivision_ranks|{{children_rank|{{Taxon info|{{{taxon}}}|rank}} }} }}} }}}
]]
--[[
| species = {{#if:{{{species|}}}|{{#if:{{{serotype|{{{strain|{{{virus|}}}}}}}}}|''{{{species}}}''|'''''{{{species}}}'''''}}}}
| virus_infrasp = {{#if:{{{serotype|{{{strain|{{{virus|}}}}}}}}}|'''{{{serotype|{{{strain|{{{virus|}}}}}}}}}'''}}
| virus_infrasp_rank = {{#if:{{{serotype|}}}|serotype<!--
-->|{{#if:{{{strain|}}}|strain<!--
-->|{{#if:{{{virus|}}}|virus}}}}}}<!--
-- SUBDIVISION RANKS: displayed above the subdivision, and generated automatically from the taxon's rank if unspecified.
-->
]]
local name = 'TO BE DONE'
local parent = parent -- TO BE FINISHED
local res = frame:expandTemplate{ title = 'Template:Taxobox/core/sandbox', args =
{ name = name,
display_taxa = displayParents,
authority =authority,
--[[
parent_authority = parentAuthority,
grandparent_authority = gparentAuthority,
grandparent_authority = gparentAuthority,
greatgrandparent_authority = ggparentAuthority,
greatgreatgrandparent_authority = gggparentAuthority,
]]
image = frame.args['image'] or '',
image_upright = frame.args['image_upright'] or '',
image_alt = frame.args['image_alt'] or '',
image_caption = frame.args['image_caption'] or '',
image2 = frame.args['image2'] or '',
image2_upright = frame.args['image2_upright'] or '',
image2_alt = frame.args['image2_alt'] or '',
image2_caption = frame.args['image2_caption'] or '',
type_genus = frame.args['type_genus'] or '',
--type_genus_authority = frame.args['type_genus_authority'] or '',
type_species = frame.args['type_species'] or '',
--type_species_authority = frame.args['type_species_authoriyt'] or ''
} }
end
return p