local p =
-- function main - entry point for templatefunction p.main(frame) local system = mw.text.trim(frame:getParent.args[1]) -- needs trim for unnamed parameters local status = mw.text.trim(frame:getParent.args[2]) local refs = mw.text.trim(frame:getParent.args[3] or "") --TODO add handling of extinct parameter return '! colspan = 2 |
' -- header row .. '\n|-' .. '\n| colspan = 2 |
' .. p._main(frame, system, status, refs) -- status content .. '
' end-- function status - entry point for direct invoke testing (assumes table structure and adds cell content)function p.status(frame) local system = mw.text.trim(frame.args[1]) local status = mw.text.trim(frame.args[2]) local refs = mw.text.trim(frame.args[3] or "") --TODO if system and status then return return p._main(frame, system, status, refs)endfunction p._main(frame, system, status, refs) local output = "ERROR" system = string.upper(system) status = string.upper(status) local systemText = "" --TODO check for system; if none give needs handling with long list of possible statuses to match current system if system
"IUCN" then output = p.IUCN31(frame, system, status) systemText = "IUCN 3.1" elseif system
"CNCFLORA" then --output = p.CNCFlora(frame, system, status) output = p.UsesIUCN31(frame, system, status) -- uses IUCN3.1 system and criteria (need to block catgories) systemText = "CNCFlora" elseif system
"SANBI" or system
"NATURESERVE" or system
"EPBC" then output = p.EPBC(frame, system, status) systemText = "EPBC Act" elseif system
"COSEWIC" then output = p.COSEWIC(frame, system, status) systemText = "COSEWIC" elseif system
"NSWBCA" then output = p.NSWBCA(frame, system, status) systemText = "NSWBCA" elseif system
"CITES" then output = p.CITES(frame, system, status) systemText = "CITES" elseif system
"" then statusText = "#Conservation status" end systemText = "See text" end output = output .. " (" .. systemText .. ")" .. refs .. "" -- "
function p.SystemNotRecognised(frame, system, status) local output = system .. ' ' .. status if status
"CR" then output = "Critically Endangered" elseif status
"NT" then output = "Near Threatened" else output = status end return output .. p.addCategory("Taxoboxes with an unrecognised status system")end
local output = system .. ' ' .. status if status
"EW" then output = p.addImage("Status iucn3.1 EW.svg") .. "Extinct in the Wild" .. p.addCategory("IUCN Red List extinct in the wild species") elseif status
"EN" then output = p.addImage("Status iucn3.1 EN.svg") .. "Endangered" .. p.addCategory("IUCN Red List endangered species") elseif status
-- | NT = frameless|link=|alt=
Near Threatened -- | LC = frameless|link=|alt=
Least Concern -- | DD = frameless|link=|alt=
Data Deficient -- | NE = Not evaluated-- | NR = Not recognized-- | PE = frameless|link=|alt=
Critically endangered, possibly extinct -- | PEW = frameless|link=|alt=
Critically endangered, possibly extinct in the wild
elseif status
"LC" then output = p.addImage("Status iucn3.1 LC.svg") .. "Least Concern" .. p.addCategory("IUCN Red List least concern species") elseif status
"NE" then output = "Not evaluated" elseif status
"PE" then output = p.addImage("Status iucn3.1 CR.svg") .. "Critically endangered, possibly extinct" .. p.addCategory("IUCN Red List critically endangered species") elseif status