Module:IUCN status
local p = {}
-- Data table for colors, full names, standardized display, and wiki article links
local status_data = {
lc = { long = "Least Concern", bg = "gray", fg = "white", is_gray = true, display = "LC", link = "Least Concern" },
vu = { long = "Vulnerable", bg = "#CC9900", fg = "#FFFFCB", display = "VU", link = "Vulnerable species" },
dd = { long = "Data Deficient", bg = "gray", fg = "white", is_gray = true, display = "DD", link = "Data Deficient" },
en = { long = "Endangered", bg = "#CC6633", fg = "#FFCC99", display = "EN", link = "Endangered species" },
cr = { long = "Critically Endangered", bg = "#CC3333", fg = "#FFCCCC", display = "CR", link = "Critically Endangered" },
nt = { long = "Near Threatened", bg = "#006666", fg = "#99CC99", display = "NT", link = "Near Threatened" },
ex = { long = "Extinct", bg = "black", fg = "#CC3333", display = "EX", link = "Extinction" },
ew = { long = "Extinct in the Wild", bg = "black", fg = "white", display = "EW", link = "Extinct in the Wild" },
re = { long = "Regionally Extinct", bg = "black", fg = "white", display = "RE", link = "Regional extinction" },
na = { long = "Not Applicable", bg = "gray", fg = "white", is_gray = true, display = "NA", link = "Not Applicable (IUCN)" },
ne = { long = "Not Evaluated", bg = "gray", fg = "white", is_gray = true, display = "NE", link = "Not Evaluated" },
-- Normalized Special Statuses
pe = { long = "Critically Endangered (Possibly Extinct)", bg = "#CC3333", fg = "#FFCCCC", display = "CR (PE)", link = "Critically Endangered (Possibly Extinct)" },
["cr(pe)"] = { long = "Critically Endangered (Possibly Extinct)", bg = "#CC3333", fg = "#FFCCCC", display = "CR (PE)", link = "Critically Endangered (Possibly Extinct)" },
pew = { long = "Critically Endangered (Possibly Extinct in the Wild)", bg = "#CC3333", fg = "#FFCCCC", display = "CR (PEW)", link = "Critically Endangered (Possibly Extinct in the Wild)" },
["cr(pew)"] = { long = "Critically Endangered (Possibly Extinct in the Wild)", bg = "#CC3333", fg = "#FFCCCC", display = "CR (PEW)", link = "Critically Endangered (Possibly Extinct in the Wild)" },
-- Legacy/Alternative Aliases
["lr/nt"] = { long = "Near Threatened", bg = "#006666", fg = "#99CC99", display = "NT", link = "Near Threatened" },
["lr/lc"] = { long = "Least Concern", bg = "gray", fg = "white", is_gray = true, display = "LC", link = "Least Concern" },
["lr/cd"] = { long = "Lower Risk/conservation dependent", bg = "#006666", fg = "#99CC99", display = "LR/cd", link = "Conservation Dependent" },
}
function p.main(frame)
local args = frame:getParent().args
local raw_input = mw.text.trim(args[1] or "")
local code = string.lower(raw_input):gsub("%s+", "")
local id = mw.text.trim(args[2] or "")
local class = mw.text.trim(args[3] or args.class or "")
local year = mw.text.trim(args.year or "")
local label = mw.text.trim(args.label or "")
local category = ""
local data = status_data[code]
-- Handle unknown codes
if not data then
data = { long = raw_input, bg = "#004080", fg = "white", display = raw_input, link = "" }
if code ~= "nr" and code ~= "" then
category = "[[Category:IUCN status templates with invalid parameters]]"
end
end
-- 1. Build the Status Badge
local style = string.format("background-color: %s; color: %s; padding: 0 1pt;", data.bg, data.fg)
if data.is_gray then style = "color: gray;" end
local title = "IUCN Red List: " .. (code == "nr" and "(taxon not recognized)" or data.long)
local display_text = (code == "nr") and ("(" .. raw_input .. ")") or data.display
local res = string.format('<span style="%s" title="%s"><b>%s</b></span>', style, title, display_text)
-- 2. Apply Wiki Link (Class 2 or 12)
if (class == "2" or class == "12") and data.link ~= "" then
res = string.format("[[%s|%s]]", data.link, res)
end
-- 3. Build the URL/Reference (Class 1 or 12)
if (class == "1" or class == "12") and id ~= "" then
local url_path = id:find("/") and "species/" or "details/"
local clean_id = id:find("/") and id or (id .. "/0")
local link_text = "IUCN"
if label ~= "" then link_text = label
elseif year ~= "" then link_text = "IUCN " .. year end
local url = string.format("https://www.iucnredlist.org/%s%s", url_path, clean_id)
res = res .. string.format('<sup> <span class="plainlinks" title="IUCN Red List assessment">[%s %s]</span></sup>', url, link_text)
end
return res .. category
end
return p
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.