Module:Storm categories/doc: Difference between revisions

Content deleted Content added
doc new func
No edit summary
 
(19 intermediate revisions by 7 users not shown)
Line 1:
{{Module rating|betaprotected}}
{{High-use}}
{{ombox|text=In order to conform to [[Wikipedia:Manual of Style/Accessibility#Color]] guidelines, do not use thesestorm colors in conjunction with links. This is necessary to avoid problems related to lack of contrast.}}
{{Lua
|Module:Storm categories/categories
|Module:Storm categories/colors
|Module:Storm categories/icons
|Module:Storm categories/demo
|noprotcat=yes
}}
This template is used to control a multitude of tropical cyclone-related templates: {{t|storm colour}}, {{t|storm name}}, and {{t|storm icon}}. It acts as a centralized ___location for storm categories to avoid discrepancies between templates, allowing for the same ID to be used across all related templates.
 
Data is located in the following submodules:
* [[Module:Storm categories/categories]] for fully-detailed storm categories
* [[Module:Storm categories/colors]] for color-only IDs
* [[Module:Storm categories/icons]] for icon-only IDs
 
== Usage ==
This module exports three functions for templates: <code>p.color</code>, <code>p.name</code>, <code>p.sortkey</code>, and <code>p.icon</code>. It also provides <code>p._color</code>, <code>p._name</code>, <code>p._sortkey</code>, and <code>p._icon</code> for use in other modules.
Line 13 ⟶ 28:
! Output
|-
||<code><nowiki><span style="padding:4px;border:1px solid black;background-color:#{{#invoke:Tropical cycloneStorm categories|color|depression}}">depression</span></nowiki></code>
|<span style="padding:4px;border:1px solid black;background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|depression}}">depression</span>
|}
 
=== Name ===
Provides the name of the given tropical cyclone category code. A optional basin argument can be provided as the second argument in order to slightly tweak the name of the category, if the given category definition supports it. This function is available as a template at {{T|Tcstorm nom listname}}.
 
{| class="wikitable"
! rowspan="2" | Code
! colspan="2" | Interpreted
! Output
! rowspan="2" | Output
|-
! ID
! Basin
|-
||<code><nowiki>{{#invoke:Tropical cycloneStorm categories|name|severe}}</nowiki></code>
|severe
|{{gray|''(default)''}}
|{{#invoke:Storm categories{{sandbox other|/sandbox}}|name|severe}}
|-
||<code><nowiki>{{#invoke:Tropical cycloneStorm categories|name|severespr - cYcL -s TorM}}</nowiki></code>
|sprcyclstorm
|{{#invoke:Tropical cyclone categories|name|severe}}
|{{gray|''(default)''}}
|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|name|spr - cYcL -s TorM}}
|-
||<code><nowiki>{{#invoke:Tropical cycloneStorm categories|name|spr - cYcL -s TorMcat5}}</nowiki></code>
|cat5
|{{#invoke:Tropical cyclone categories|name|spr - cYcL -s TorM}}
|{{gray|''(default)''}}
|{{#invoke:Storm categories{{sandbox other|/sandbox}}|name|cat5}}
|-
||<code><nowiki>{{#invoke:Tropical cycloneStorm categories|name|cat5|ATl}}</nowiki></code>
|cat5
|{{#invoke:Tropical cyclone categories|name|cat5}}
|ATl
|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|name|cat5|ATl}}
|-
||<code><nowiki>{{#invoke:Tropical cycloneStorm categories|name|cat5|WPac}}</nowiki></code>
|cat5
|{{#invoke:Tropical cyclone categories|name|cat5|WPac}}
|WPac
|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|name|cat5|WPac}}
|}
 
=== Sortkey ===
The sortkey is a number that aids in sorting categories. Using the sortkey, it is possible to automatically sort a table of tropical cyclones given their category code. Due to the ambiguous nature of sortkeys, tables may be sorted incorrectly if values from other basins were used. For categories that span multiple basins, however, (e.g. <code>depression</code> and <code>storm</code>) they are given the lowest possible sortkeys in order to achieve maximum compatibility.
{{#ifeq:{{BASEPAGENAME}}|Storm categories|
 
<p>This sortkey is used in {{T|Tropical cyclone season effects (cyclone)}}, a subtemplate of {{T|Tropical cyclone season effects}}.</p>
}}
 
The sortkey format is as follows. Note that not all values between the given ranges were used. The arrangement of these were determined by their positions in the {{T|Storm colour}} template.
{| class="wikitable"
Line 75 ⟶ 107:
{| class="wikitable sortable"
! Category
! data-sort-type="number" | Sortkey
! Code
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|cat3}}" |
| cat3
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|cat3}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|cat3}}</nowiki></code>
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|cat1}}"
| cat1
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|cat1}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|cat1}}</nowiki></code>
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|cat5}}"
| cat5
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|cat5}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|cat5}}</nowiki></code>
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|cat4}}"
| cat4
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|cat4}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|cat4}}</nowiki></code>
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|depression}}"
| depression
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|depression}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|depression}}</nowiki></code>
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|cat2}}"
| cat2
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|cat2}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|cat2}}</nowiki></code>
|}
 
Line 108 ⟶ 140:
! Sortkey
! Code
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|typhoon}}" |
| typhoon
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|typhoon}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|typhoon}}</nowiki></code>
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|potential}}"
| potential
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|potential}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|potential}}</nowiki></code>
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|cat5}}"
| cat5
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|cat5}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|cat5}}</nowiki></code>
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|svrcyclstorm}}"
| svrcyclstorm
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|svrcyclstorm}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|svrcyclstorm}}</nowiki></code>
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|unknown}}"
| unknown
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|unknown}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|unknown}}</nowiki></code>
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|supertyphoon}}"
| supertyphoon
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|supertyphoon}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|supertyphoon}}</nowiki></code>
|- style="background-color:#{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|color|niodepression}}"
| niodepression
| {{nts|{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|sortkey|niodepression}}}}
|| <code><nowiki>{{#invoke:Tropical cycloneStorm categories|sortkey|niodepression}}</nowiki></code>
|}
{{cbot}}
 
=== Icon ===
Icons exist for some tropical cycloneStorm categories for presentation purposes. This function is available as a template at {{T|Tropical cyclone statusstorm iconsicon}}. <code>p.icon</code> will return wikitext of an image or formatted text.
 
=== Full list of available values ===
Line 146 ⟶ 178:
 
It will show any color errors, including colors which aren't compliant with the minimal [[Web Content Accessibility Guidelines#WCAG 2.0|Web Content Accessibility Guidelines 2.0]] AA color standards (see [[MOS:COLOR]] for more information).
{{#invoke:Tropical cycloneStorm categories{{sandbox other|/sandbox}}|demo}}
 
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandboxSandbox other| |
<!-- Categories below this line, please; interwikis at Wikidata -->
[[Category:Storm category templates]]
[[Category:Tropical cyclone templates]]
[[Category:Non-tropical storms templates]]
 
}}</includeonly>