Module:Conservation status explained

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 |

Conservation status

' -- 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

"IUCN3.1" or system

"IUCN" then output = p.IUCN31(frame, system, status) systemText = "IUCN 3.1" elseif system

"IUCN2.3" then output = p.IUCN23(frame, system, status) systemText = "IUCN 2.3" 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

"TPWCA" then output = p.UsesIUCN31(frame, system, status) -- uses IUCN3.1 system and criteria (need to block catgories) systemText = "TPWCA" elseif system

"SANBI" or system

"RLSAP" then output = p.SANBI(frame, system, status) systemText = "SANBI Red List" elseif system

"NATURESERVE" or system

"TNC" then output = p.NatureServe(frame, system, status) systemText = "NatureServe" elseif system

"EPBC" then output = p.EPBC(frame, system, status) systemText = "EPBC Act" elseif system

"ESA" then output = p.ESA(frame, system, status) systemText = "ESA" elseif system

"COSEWIC" then output = p.COSEWIC(frame, system, status) systemText = "COSEWIC" elseif system

"DECF" then output = p.DECF(frame, system, status) systemText = "DEC" elseif system

"NSWBCA" then output = p.NSWBCA(frame, system, status) systemText = "NSWBCA" elseif system

"QLDNCA" then output = p.QLDNCA(frame, system, status) systemText = "NCA" elseif system

"CITES" then output = p.CITES(frame, system, status) systemText = "CITES" elseif system

"NZTCS" then output = p.NZTCS(frame, system, status) systemText = "NZ TCS" else output = p.SystemNotRecognised(frame, system, status) systemText = "" .. system .. "" -- should this be linked? end if output ~= "ERROR" then --[=[ template code <small>&nbsp;({{#if:{{{status_text|}}} |[[{{{status_text|#Conservation status}}}|See text]] -- links to section in article? |IUCN 3.1}}) ]=] local statusText = frame:getParent.args['status_text'] --local systemText = " IUCN 3.1" if statusText then if statusText

"" then statusText = "#Conservation status" end systemText = "See text" end output = output .. " (" .. systemText .. ")" .. refs .. "" -- "

" return output endend--OTHER SYSTEMS Territory Parks and Wildlife Conservation Act 2000 (TPWCA)

function p.SystemNotRecognised(frame, system, status) local output = system .. ' ' .. status if status

"EX" then local extinct = "Extinct" if frame:getParent.args['extinct'] then extinct = " (" .. frame:getParent.args['extinct'] .. ")" end output = p.addImage("Status iucn3.1 EX.svg") .. extinct elseif status

"CR" then output = "Critically Endangered" elseif status

"EN" then output = "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

"EX" then local extinct = "Extinct" if frame:getParent.args['extinct'] then extinct = " (" .. frame:getParent.args['extinct'] .. ")" end output = p.addImage("Status iucn3.1 EX.svg") .. extinct .. p.addCategory("IUCN Red List extinct species") elseif 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

"CR" then output = p.addImage("Status iucn3.1 CR.svg") .. "Critically Endangered" .. p.addCategory("IUCN Red List critically endangered species") elseif status

"EN" then output = p.addImage("Status iucn3.1 EN.svg") .. "Endangered" .. p.addCategory("IUCN Red List endangered species") elseif status

"VU" then output = p.addImage("Status iucn3.1 VU.svg") .. "Vulnerable" .. p.addCategory("IUCN Red List vulnerable species")

-- | 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

"NT" then output = p.addImage("Status iucn3.1 NT.svg") .. "Near Threatened" .. p.addCategory("IUCN Red List near threatened species") elseif status

"LC" then output = p.addImage("Status iucn3.1 LC.svg") .. "Least Concern" .. p.addCategory("IUCN Red List least concern species") elseif status

"DD" then output = p.addImage("Status iucn3.1 blank.svg") .. "Data Deficient" .. p.addCategory("IUCN Red List data deficient species") elseif status

"NE" then output = "Not evaluated" elseif status

"NR" then output = "Not recognized" 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