Module:WPSHIPS utilities/doc
Appearance
![]() | This is a documentation subpage for Module:WPSHIPS utilities. It may contain usage information, categories and other content that is not part of the original module page. |
format_ship_name
This function attempts to apply appropriate formatting to unformatted ship names. The formats supported are:
- <prefix> <name> <(disambiguator)> where:
- <prefix> – one from a list of defined prefixes commonly used for ships (ARA, HMS, USS, etc.); rendered in upright font
- <name> – the ship's proper name; rendered in italic font
- <(disambiguator)> (optional) – typically the ship's hull or pennant number, or other disambiguator; always contained in parentheses; rendered in upright font
- <name> <(disambiguator)> where:
- <name> – the ship's proper name; rendered in italic font
- <(disambiguator)> (required) – the ship's hull or pennant number or a recognized ship-type descriptor; always contained in parentheses; rendered in upright font
- hull and pennant numbers take two basic forms
- uppercase letters, possibly followed by a space or hyphen, followed by digits (SSBN-659, R07, ON 688)
- digits, possibly followed by a space or hyphen, followed by uppercase letters (401B)
- hull and pennant numbers take two basic forms
- <nationality> <ship type> <name> <(disambiguator)> where:
- <nationality> – one- or two- word nation name in adjectival form (Dutch, East Timorese, French, Ottoman, etc.); rendered in upright font
- <ship type> – one from a list of one- to four-word phrases that describes a ship's type (aviso, brig sloop, landing ship medium, ship of the line); rendered in upright font
- <name> – the ship's proper name; rendered in italic font
- <(disambiguator)> (optional) – typically the ship's hull or pennant number, or other disambiguator; always contained in parentheses; rendered in upright font
The function will also attempt to render ship-class names when the name is in the form:
- <name>-class <ship type> where:
- <name> – the class' proper name; rendered in italic font according to the setting of
|sclass=
- <ship type> – a phrase that describes a ship's type; rendered in upright font
- <name> – the class' proper name; rendered in italic font according to the setting of
Lists
The function relies on three lists to accomplish its task. These lists are:
ship_prefix_list
– a list of commonly used ship prefixes initially taken from{{ship prefix}}
; these are usually, but not always wholly uppercasenationality_list
– a list of nation names in their adjectival form; these are always capitalized; always one or two wordsship_type_list
– a list ship-type descriptor phrases; these are usually, but not always wholly lowercase; always one to two words
To add to any of these lists, the form is:
['addition'] = true,
the trailing comma is important. See the instructions that accompany each list for limitations and implementation details.
Usage
The minimal form is:
{{#invoke:WPSHIPS_utilities|ship_name_format|name=}}
Parameters
The function requires one parameter and supports several optional parameters.
- |name= – (required) the name to format
- |dab=none – for use with
|infobox caption=nodab
in{{infobox ship begin}}
, excludes a disambiguator from the formatted name - |sclass=2 – for use with
{{DISPLAYTITLE}}
and with|infobox caption=yes
or|infobox caption=nodab
in{{infobox ship begin}}
, when the class is not named for a member of the class; causes the class name to be rendered in upright font - |adj=off – for use in ship-class articles with
|infobox caption=yes
or|infobox caption=nodab
in{{infobox ship begin}}
, formats the class name in its noun form and excludes the ship type phrase and disambiguator - |showerrs=yes – debug tool; not currently supported in any templates;