Difference between revisions of "Template:MS/doc"

From blackwiki
Jump to navigation Jump to search
imported>Swpb
m (→‎See also: clean up using AWB)
imported>DePiep
Line 32: Line 32:
 
Last example could be used to link to ship index (disambiguation) page
 
Last example could be used to link to ship index (disambiguation) page
  
=== Optional display control parameter ===
+
* To show "M/S", use {{tl|M/S}}: {{M/S|Antenor|1957}}
There is an optional third parameter that controls which pieces of text are displayed in the article. Its value is treated as a binary number and will display the corresponding "bits".  So setting the 8's bit will add a slash ("/") in the prefix, the 4's bit will display MS, setting the 2's bit will display the ship name, and setting the 1's bit will display the ID.  If binary math isn't your thing, refer to these examples:
+
* To link to [[S/Y Manitou]], use <nowiki>{{Ship|S/Y|Manitou}}</nowiki>
{|class=wikitable width=100%
+
 
 +
By default, the wikilink is build like this:
 +
* <code><nowiki>{{MS|Antenor|1957}}</nowiki></code>, the targetpage is
 +
: {{nowrap|1=<code><nowiki>[[MS Antenor (1957)]]</nowiki></code>}}.
 +
:Then the template by default adds the formatted label:
 +
:<code><nowiki>[[targetpage|label]]</nowiki></code>
 +
:<code><nowiki>[[MS Antenor (1957)|MS ''Antenor'' (1957)]]</nowiki></code>, showing as:
 +
: {{nowrap|1={{MS|Antenor|1957}}}}.
 +
 
 +
The default label can be changed with a simple parameter. The extra ''third position'', unnamed parameter allows setting which elements of the ship's full name are shown in the wikilink. It sets the ''label'' in the link:
 +
For example, in your article, the hull number (disambiguator) may not be needed to show. In that case, add option {{para||2}}, and the result is:
 +
* <code><nowiki>{{</nowiki>MS|Antenor|1957<span style="background:yellow;">|2</span>}}</code> &rarr;
 +
:<code><nowiki>[[MS Antenor (1957)|''Antenor'']]</nowiki></code> &rarr;
 +
:{{MS|Antenor|1957|2}}
 +
 
 +
The options are:
 +
{|class=wikitable style="font-size: 90%; text-align: left; width: 100%;"
 
! Value
 
! Value
! Parameter(s)<br>displayed
+
! Will show
 
! Example
 
! Example
! Equivalent wikicode
+
! Wikilink {{nobold|1=<nowiki>[[targetpage|label]]</nowiki>}}
! Final result
+
! Shows
 
|-
 
|-
! None
+
! {{nobold|1=(default)}}
| style="text-align:center;" | all
+
| PREFIX ''name'' (ID)
| <tt><nowiki>{{MS|Antenor|1957}}</nowiki></tt>
+
| <nowiki>{{MS|Antenor|1957}}</nowiki>
| <tt><nowiki>[[MS Antenor (1957) |MS ''Antenor'' (1957)]]</nowiki></tt>
+
| <nowiki>[[MS Antenor (1957)|MS ''Antenor'' (1957)]]</nowiki>
 
| {{MS|Antenor|1957}}
 
| {{MS|Antenor|1957}}
 
|-
 
|-
 
! 1
 
! 1
| style="text-align:center;" | 3rd
+
| ''ID''
| <tt><nowiki>{{MS|Antenor|1957|1}}</nowiki></tt>
+
| <nowiki>{{MS|Antenor|1957|1}}</nowiki>
| <tt><nowiki>[[MS Antenor (1957) |1957]]</nowiki></tt>
+
| <nowiki>[[MS Antenor (1957)|''1957'']]</nowiki>
 
| {{MS|Antenor|1957|1}}
 
| {{MS|Antenor|1957|1}}
 
|-
 
|-
 
! 2
 
! 2
| style="text-align:center;" | 2nd
+
| ''name''
| <tt><nowiki>{{MS|Antenor|1957|2}</nowiki>}</tt>
+
| <nowiki>{{MS|Antenor|1957|2}}</nowiki>
| <tt><nowiki>[[MS Antenor (1957) |''Antenor'']]</nowiki></tt> 
+
| <nowiki>[[MS Antenor (1957)|''Antenor'']]</nowiki>
 
| {{MS|Antenor|1957|2}}
 
| {{MS|Antenor|1957|2}}
 
|-
 
|-
 
! 3
 
! 3
| style="text-align:center;" | 2nd, 3rd
+
| ''name'' (ID)
| <tt><nowiki>{{MS|Antenor|1957|3}</nowiki>}</tt>
+
| <nowiki>{{MS|Antenor|1957|3}}</nowiki>
| <tt><nowiki>[[MS Antenor (1957) |''Antenor'' (1957)]]</nowiki></tt>
+
| <nowiki>[[MS Antenor (1957)|''Antenor'' (1957)]]</nowiki>
 
| {{MS|Antenor|1957|3}}
 
| {{MS|Antenor|1957|3}}
 
|-
 
|-
! 4
+
! 4 {{nobold|1=<small>(dflt)</small>}}
| style="text-align:center;" | invalid result
+
| PREFIX ''name'' (ID)
| <tt><nowiki>{{MS|Antenor|1957|4}</nowiki>}</tt>
+
| <nowiki>{{MS|Antenor|1957|4}}</nowiki>
| <tt><nowiki>[[MS Antenor (1957) |Invalid Optional Parameter]]</nowiki></tt> 
+
| <nowiki>[[MS Antenor (1957)|MS ''Antenor'' (1957)]]</nowiki>
 
| {{MS|Antenor|1957|4}}
 
| {{MS|Antenor|1957|4}}
 
|-
 
|-
 
! 5
 
! 5
| style="text-align:center;" | 1st, 3rd
+
| PREFIX ''ID''
| <tt><nowiki>{{MS|Antenor|1957|5}</nowiki>}</tt>
+
| <nowiki>{{MS|Antenor|1957|5}}</nowiki>
| <tt><nowiki>[[MS Antenor (1957) |MS (1957)]]</nowiki></tt> 
+
| <nowiki>[[MS Antenor (1957)|MS ''1957'']]</nowiki>
 
| {{MS|Antenor|1957|5}}
 
| {{MS|Antenor|1957|5}}
 
|-
 
|-
 
! 6
 
! 6
| style="text-align:center;" | 1st, 2nd
+
| PREFIX ''name''
| <tt><nowiki>{{MS|Antenor|1957|6}</nowiki>}</tt>
+
| <nowiki>{{MS|Antenor|1957|6}}</nowiki>
| <tt><nowiki>[[MS Antenor (1957) |MS ''Antenor'']]</nowiki></tt> 
+
| <nowiki>[[MS Antenor (1957)|MS ''Antenor'']]</nowiki>
 
| {{MS|Antenor|1957|6}}
 
| {{MS|Antenor|1957|6}}
|-
 
! 8
 
| style="text-align:center;" | all (with "M/S")
 
| <tt><nowiki>{{MS|Antenor|1957|8}}</nowiki></tt>
 
| <tt><nowiki>[[MS Antenor (1957)|M/S ''Antenor'' (1957)]]</nowiki></tt>
 
| {{MS|Antenor|1957|8}}
 
|-
 
! 13
 
| style="text-align:center;" | 1st, 3rd (with "M/S")
 
| <tt><nowiki>{{MS|Antenor|1957|13}</nowiki>}</tt>
 
| <tt><nowiki>[[MS Antenor (1957)|M/S (1957)]]</nowiki></tt> 
 
| {{MS|Antenor|1957|13}}
 
|-
 
! 14
 
| style="text-align:center;" | 1st, 2nd (with "M/S")
 
| <tt><nowiki>{{MS|Antenor|1957|14}</nowiki>}</tt>
 
| <tt><nowiki>[[MS Antenor (1957)|M/S ''Antenor'']]</nowiki></tt> 
 
| {{MS|Antenor|1957|14}}
 
|-
 
|
 
| style="text-align:center;" | 2nd<br><small>(no 3rd)</small>
 
| <tt><nowiki>{{MS|Princess of Norway|3=2}}</nowiki></tt> <br/> ''Alternate usage'': <tt><nowiki>{{MS|Princess of Norway||2}}</nowiki></tt>
 
| <tt><nowiki>[[MS Princess of Norway |''Princess of Norway'']]</nowiki></tt>
 
| {{MS|Princess of Norway||2}}
 
 
|}
 
|}
''N.B.'': Be careful with the third parameter if not using the second parameter. In the ''Princess of Norway'' example above, the "|3=2" means set the third parameter to a value of two, while the alternate syntax shows using a pair of pipes, "||2", to position the value two in the third parameter position.  
+
:{{small|1=''Note'': options default (=blank), 2 and 6 are mostly used.}}<!--
  
Using an optional display control parameter value of 6 yields the same results as using {{tl|warship}} to create the same link and text, but saving, coincidentally, 6 characters while editing.
+
--><noinclude>{{documentation}}</noinclude>
  
  <tt><nowiki>{{MS|Antenor|1957}}</nowiki></tt> yields the same results as <tt><nowiki>{{warship|MS|Antenor|1957}}</nowiki></tt>
 
 
==Template data==
 
==Template data==
 
{{TemplateDataHeader}}
 
{{TemplateDataHeader}}

Revision as of 15:59, 16 March 2018

Usage

This is a typing short cut for linking to steamship articles named in the format "MS Shipname (Year)". Since ship names are italicized in article text, linking to them in the usual manner means typing everything twice, such as [[MS Shipname (ID)|MS ''Shipname'' (ID)]]. This template halves that to {{MS|Shipname|ID}}.

Formal Usage

  • {{MS|Ship Name}}
  • {{MS|Ship Name|ID}}, where ID can be the hull number, launch year, or pennant number, as specified in the article title.

Examples

Template usage Equivalent wikicode Final result
{{MS|Antenor|1957}} [[MS Antenor (1957)|MS ''Antenor'' (1957)]] MS Antenor (1957)
{{MS|Queen Victoria|ship}} [[MS Queen Victoria (ship)|MS ''Queen Victoria'' (ship)]] MS Queen Victoria (ship)
{{MS|Princess of Norway}} [[MS Princess of Norway|MS ''Princess of Norway'']] MS Princess of Norway

Last example could be used to link to ship index (disambiguation) page

By default, the wikilink is build like this:

  • {{MS|Antenor|1957}}, the targetpage is
[[MS Antenor (1957)]].
Then the template by default adds the formatted label:
[[targetpage|label]]
[[MS Antenor (1957)|MS ''Antenor'' (1957)]], showing as:
MS Antenor (1957).

The default label can be changed with a simple parameter. The extra third position, unnamed parameter allows setting which elements of the ship's full name are shown in the wikilink. It sets the label in the link: For example, in your article, the hull number (disambiguator) may not be needed to show. In that case, add option |2, and the result is:

  • {{MS|Antenor|1957|2}}
[[MS Antenor (1957)|''Antenor'']]
Antenor

The options are:

Value Will show Example Wikilink [[targetpage|label]] Shows
(default) PREFIX name (ID) {{MS|Antenor|1957}} [[MS Antenor (1957)|MS ''Antenor'' (1957)]] MS Antenor (1957)
1 ID {{MS|Antenor|1957|1}} [[MS Antenor (1957)|''1957'']] 1957
2 name {{MS|Antenor|1957|2}} [[MS Antenor (1957)|''Antenor'']] Antenor
3 name (ID) {{MS|Antenor|1957|3}} [[MS Antenor (1957)|''Antenor'' (1957)]] Antenor (1957)
4 (dflt) PREFIX name (ID) {{MS|Antenor|1957|4}} [[MS Antenor (1957)|MS ''Antenor'' (1957)]] MS Antenor (1957)
5 PREFIX ID {{MS|Antenor|1957|5}} [[MS Antenor (1957)|MS ''1957'']] MS 1957
6 PREFIX name {{MS|Antenor|1957|6}} [[MS Antenor (1957)|MS ''Antenor'']] MS Antenor
Note: options default (=blank), 2 and 6 are mostly used.
Template documentation[create]

Template data

This is the TemplateData documentation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.

TemplateData for MS

This template provides a wikilink to a ship's page, with label options

Template parameters

ParameterDescriptionTypeStatus
Prefix1

Fleet identifier

Example
HMS, Japanese battleship
Stringoptional
Name2

Ship's name

Example
Bismarck, Belgrano
Stringoptional
ID3

Hull number, launch year, or pennanr number

Example
H75, 1975,
Stringoptional
Format4

Formats label (parts showing)

Default
blank
Example
1, 2, 3, 5, 6
Numberoptional
unlink prefixup

yes=puts Fleet ID outside of Wikilink

Default
no
Example
up=yes
Booleanoptional

See also

Template:WPSHIPS shortcut templates