Difference between revisions of "Template:JS/doc"

From blackwiki
Jump to navigation Jump to search
imported>WOSlinker
(tidy style)
imported>DePiep
m (Add TemplateData (via WP:JWB))
Line 1: Line 1:
 
{{Documentation subpage}}
 
{{Documentation subpage}}
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
 
  
 
== Usage ==
 
== Usage ==
Line 22: Line 21:
 
  | {{JDS|Wakaba|DE-261}}
 
  | {{JDS|Wakaba|DE-261}}
 
  |}
 
  |}
 
  
 
=== Optional display control parameter ===
 
=== Optional display control parameter ===
Line 75: Line 73:
 
| {{JS|Ashigara|DDG-178|6}}
 
| {{JS|Ashigara|DDG-178|6}}
 
|}
 
|}
 +
==Template data==
 +
{{TemplateDataHeader}}
 +
<templatedata>
 +
{
 +
"params": {
 +
"1": {
 +
"label": "Prefix",
 +
"description": "Fleet identifier",
 +
"example": "HMS, Japanese battleship",
 +
"type": "string"
 +
},
 +
"2": {
 +
"label": "Name",
 +
"description": "Ship's name",
 +
"example": "Bismarck, Belgrano",
 +
"type": "string"
 +
},
 +
"3": {
 +
"label": "ID",
 +
"description": "Hull number, launch year, or pennanr number",
 +
"example": "H75, 1975, ",
 +
"type": "string"
 +
},
 +
"4": {
 +
"label": "Format",
 +
"description": "Formats label (parts showing)",
 +
"example": "1, 2, 3, 5, 6",
 +
"default": "blank",
 +
"type": "number"
 +
},
 +
"up": {
 +
"label": "unlink prefix",
 +
"description": "yes=puts Fleet ID outside of Wikilink",
 +
"example": "up=yes",
 +
"default": "no",
 +
"type": "boolean"
 +
}
 +
},
 +
"description": "This template provides a wikilink to a ship's page, with label options",
 +
"paramOrder": [
 +
"1",
 +
"2",
 +
"3",
 +
"4",
 +
"up"
 +
]
 +
}
 +
</templatedata>
  
 
== See also ==
 
== See also ==
Line 80: Line 126:
  
 
<includeonly>
 
<includeonly>
 
<!-- ADD CATEGORIES BELOW THIS LINE -->
 
  
 
[[Category:Ship templates|JS]]
 
[[Category:Ship templates|JS]]
 
<!-- ADD INTERWIKIS BELOW THIS LINE -->
 
  
 
</includeonly>
 
</includeonly>

Revision as of 17:58, 28 February 2018

Usage

This is a typing short cut for linking to modern Japan Maritime Self-Defense Force ship articles named in the format "JS Deep Six (AWOL-99)". Since ship names are italicized in article text, linking to them in the usual manner means typing everything twice, such as [[JS Deep Six (AWOL-99)|JS ''Deep Six'' (AWOL-99)]]. This template halves that to {{JDS|Deep Six|AWOL-99}}.

Formal usage

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

Example

Template usage Equivalent wikicode Final result
{{JDS|Ashigara|DDG-178}} [[JDS Ashigara (DDG-178)|JDS ''Ashigara'' (DDG-178)]] JDS Wakaba (DE-261)

Optional display control parameter

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 4's bit will display BRP, 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:

Value Parameter(s)
displayed
Example Equivalent wikicode Final result
None all {{JS|Ashigara|DDG-178}} [[JS Ashigara (DDG-178)|JS ''Ashigara'' (DDG-178)]] JS Ashigara (DDG-178)
1 3rd {{JS|Ashigara|DDG-178|1}} [[JS Ashigara (DDG-178)|DDG-178]] DDG-178
2 2nd {{JS|Ashigara|DDG-178|2}} [[JS Ashigara (DDG-178)|''Ashigara'']] Ashigara
3 2nd, 3rd {{JS|Ashigara|DDG-178|3}} [[JS Ashigara (DDG-178)|''Ashigara'' (DDG-178)]] Ashigara (DDG-178)
4 invalid result {{JS|Ashigara|DDG-178|4}} [[JS Ashigara (DDG-178)|Invalid Optional Parameter]] JS Ashigara (DDG-178)
5 1st, 3rd {{JS|Ashigara|DDG-178|5}} [[JS Ashigara (DDG-178)|JS (DDG-178)]] JS DDG-178
6 1st, 2nd {{JS|Ashigara|DDG-178|6}} [[JS Ashigara (DDG-178)|JS ''Ashigara'']] JS Ashigara

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 JS

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