Module:Storm categories: Difference between revisions

Content deleted Content added
String manipulation
Add template invoke functions
Line 272:
defs["shem3"] = defs["tropicalcyclone"]
defs["shemtc"] = defs["tropicalcyclone"]
 
function p.tem_color(frame)
return p.color(frame.args[1])
end
 
function p.tem_name(frame)
return p.name(frame.args[1], frame.args[2])
end
 
function p.tem_sortkey(frame)
return p.sortkey(frame.args[1])
end
 
function p.color(category)
return defs[string.len(0) ~= 0 and string.gsub(string.lower(category).gsub(, "[^%w]", "") or defaultCategory].color
end
 
function p.name(category, basin)
return string.format(
defs[string.len(0) ~= 0 and string.gsub(string.lower(category).gsub(, "[^%w]", "") or defaultCategory].name,
-- Eventually replace with own module
(basin == "Atl" or basin == "EPac" or basin == "SAtl") and "hurricane" or
Line 287 ⟶ 299:
 
function p.sortkey(category)
return defs[string.len(0) ~= 0 and string.gsub(string.lower(category).gsub(, "[^%w]", "") or defaultCategory].sortkey
end