require('strict')local getArgs = require ('Module:Arguments').getArgs;
local p = -- exposed variables
--local pargs = local template = local args =
-- parse the taxon list and get the taxon parameter and authority from the lowest rank (clear the parameters)function p.get_taxon(frame, option) args['taxon'] = "taxon name" local ranks = require ('Module:Biota_infobox/data').taxonRanks; -- get the list of rank parameters used by manual taxoboxes -- interate throught the rank parameters, setting taxon to each in turn. -- The lowest rank parameter should hold the taxon name for the taxoox local rank for k,v in pairs(ranks) do if args[v] then -- if rank parameter rank = v args['taxon'] = args[rank]:gsub("[%[%]%']", "") -- strip wiki formatting and set taxon parameter --args['rank'] = rank args['authority'] = args[rank.."_authority"] or "" -- set authority args[rank] = nil end end args[rank.."_authority"] = nil -- delete the authority of taxon (e.g. familia_authority for family) but keep parent taxon authorities if providedend
-- remove the taxon parameters apart from genus and speciesfunction p.clear_taxon_parameters (frame) local ranks = require ('Module:Biota_infobox/data').taxonRanks; -- get the list of rank parameters used by manual taxoboxes for k,v in pairs(ranks) do if v ~= "genus" and v ~= "species" then args[v] = nil end endend
-- add the parameter line with appropriate stripping of wikitext function p.addParam(param)
if args[param] then local value = args[param] if param
'species' then --value = value:gsub("[%'%[%]]","") value = value:gsub("[%'%[]*[A-Za-z%.]* ([A-Za-z]*)[%]%']*","%1") --value='albopunctatus' elseif param
'name' and args['name']
function p.convert(frame) --args = frame:getParent.args args = getArgs (frame); local mode = "speciesbox" if args['genus'] and args['species'] then table.insert (template, '