Module:Conservation status
Appearance
![]() | This module is rated as beta, and is ready for widespread use. It is still new and should be used with some caution to ensure the results are as expected. |
![]() | This module is subject to page protection. It is a highly visible module in use by a very large number of pages, or is substituted very frequently. Because vandalism or mistakes would affect many pages, and even trivial editing might cause substantial load on the servers, it is protected from editing. |
Module to generate conservation status information in taxoboxes. Plan is to replace {{Taxobox/species}}.
Usage
Entry point function "status", currently used in {{taxobox/species}} for some conservation systems:
{{#invoke:Conservation status|status|conservation status system|conservation status code|status reference}}
The entry point function "main" is planned to replace {{taxobox/species}}.
local p = {}
function p.main(frame)
local status = frame:getParent().args[2]
local system = frame:getParent().args[1]
system = string.upper(system)
status = string.upper(status)
if system == "IUCN3.1" or system == "IUCN" then
return p.IUCN31(system, status)
end
return system .. ' ' .. status
end
function p.IUCN31(system, status)
-- | EN = [[file:Status iucn3.1 EN.svg|frameless|link=|alt=]]<br />[[Endangered species|Endangered]]
-- {{#ifeq: {{NAMESPACEE}} | {{ns: 0}} | [[Category:IUCN Red List endangered species]] | }}
local output = ""
if status == "EN" then
output = "[[file:Status iucn3.1 EN.svg|frameless|link=|alt=]]<br />[[Endangered species|Endangered]]"
.. p.addCategory("IUCN Red List endangered species")
return output
end
return system .. ' ' .. status
end
function p.addCategory(category)
local ns = mw.title.getCurrentTitle().namespace
-- ns = 0 -- to test category put on page
if category ~= "" and ns == 0 then
return "[[Category:" .. category .. "]]"
end
return ""
end
return p