Module:WPSHIPS utilities/doc

This function attempts to apply appropriate formatting to unformatted ship names. The formats supported are:
 * 1)  <(disambiguator)> where:
 * 2) * – one from a list of defined prefixes commonly used for ships (ARA, HMS, USS, etc.); rendered in upright font
 * 3) * – the ship's proper name; rendered in italic font
 * 4) *<(disambiguator)> (optional) – typically the ship's hull or pennant number, or other disambiguator; always contained in parentheses; rendered in upright font
 * 5) <(disambiguator)> where:
 * 6) * – the ship's proper name; rendered in italic font
 * 7) *<(disambiguator)> (required) – the ship's hull or pennant number or a recognized ship-type descriptor; always contained in parentheses; rendered in upright font
 * 8) **hull and pennant numbers take two basic forms
 * 9) ***uppercase letters, possibly followed by a space or hyphen, followed by digits (SSBN-659, R07, ON 688)
 * 10) ***digits, possibly followed by a space or hyphen, followed by uppercase letters (401B)
 * 11)   <(disambiguator)> where:
 * 12) * – one- or two- word nation name in adjectival form (Dutch, East Timorese, French, Ottoman, etc.); rendered in upright font
 * 13) * – 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
 * 14) * – the ship's proper name; rendered in italic font
 * 15) *<(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:
 * -class where:
 * – the class' proper name; rendered in italic font according to the setting of sclass
 * – a phrase that describes a ship's type; rendered in upright font

Lists
The function relies on three lists to accomplish its task. These lists are:
 * 1)  – a list of commonly used ship prefixes initially taken from ; these are usually, but not always wholly uppercase
 * 2)  – a list of nation names in their adjectival form; these are always capitalized; always one or two words
 * 3)  – 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:

the trailing comma is important. See the instructions that accompany each list for limitations and implementation details.

Usage
The minimal form is:

Parameters
The function requires one parameter and supports several optional parameters.
 * |name= – (required) the name to format
 * |dab=none – for use with nodab in, excludes a disambiguator from the formatted name
 * |sclass=2 – for use with  and with yes or nodab in, 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 yes or nodab in, 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;

This function is the driver for. The function assembles an external wikilink from known fragments and positional parameter. A ship name provided in positional parameter  is formatted using. New with this implementation of is the addition of showerrs. The  in the template defaults to yes which can be overridden by setting no in the template.

Similar to, this code supports by attempting to construct a link to a ship article at the Historic Naval Ships Association website.

The template has the form:

where:
 * is the name of the page from the url
 * (optional) is the name of the ship; if left blank, the template uses the current page title; if a ship name, it is formatted using

from which this code produces: