Template:Postal: Difference between revisions

From stencil.wiki
m (Robertbaxter moved page Template:Postal abbreviation to Template:Postal without leaving a redirect)
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
<!-- This should probably become a Lua module at some point, the #if chaining is going to get cumbersome if too many more patterns are added --><noinclude>
<noinclude>
This template replaces a state or province with the equivalent 2-letter postal code.
This template replaces a state or province with the equivalent 2-letter postal code.


== Usage ==
== Usage ==
The state or province should be passed as the only parameter of template. If the provided text is not recognized in the list on this page, the original text is displayed.
The state or province should be passed as the only parameter of template. If the provided text is not recognized in the list on this page, the original text is displayed.
<pre>{{postal|Wisconsin}}</pre>
<pre>{{postal|Wisconsin}}
{{postal|Arizona}}
{{postal|Quebec}}
{{postal|Bookland}}</pre>
{{postal|Wisconsin}}
{{postal|Wisconsin}}
{{postal|Arizona}}
{{postal|Quebec}}
{{postal|Bookland}}


== TemplateData ==
== TemplateData ==
Line 21: Line 27:
}
}
</templatedata>
</templatedata>
</noinclude><includeonly>
</noinclude><includeonly><!--
{{#switch: {{{1}}}
-->{{#switch: {{{1}}}
  | Alabama = AL
  | Alabama = AL
  | Alaska = AK
  | Alaska = AK
Line 96: Line 102:
  | Yukon = YT
  | Yukon = YT
  | {{{1}}}
  | {{{1}}}
}}
}}<!--
<nowiki/></includeonly>
--></includeonly>

Latest revision as of 16:17, 3 September 2025

This template replaces a state or province with the equivalent 2-letter postal code.

Usage

The state or province should be passed as the only parameter of template. If the provided text is not recognized in the list on this page, the original text is displayed.

{{postal|Wisconsin}}
{{postal|Arizona}}
{{postal|Quebec}}
{{postal|Bookland}}

WI AZ QC Bookland

TemplateData

A postal abbreviation transform.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
State/province1

The state or province

Stringrequired