Template talk:Ship

From Wikipedia, the free encyclopedia
  (Redirected from Template talk:Warship)
Jump to: navigation, search
WikiProject Ships (Rated Template-class)
WikiProject icon This template is within the scope of WikiProject Ships, a project to improve all Ship-related articles. If you would like to help improve this and other articles, please join the project. All interested editors are welcome. To use this banner, please see the full instructions. WikiProject icon
 Template  This template does not require a rating on the project's quality scale.

Initial documentation[edit]

This template easily formats wikilinks to warship articles so as to synchronize Wikipedia's article titling policy with common body-text usage. It cuts the amount of piping to a minimum, inserts italics in the appropriate place, and (arguably) makes deciphering the markup somewhat easier.

To insert a wikilink to warship, insert the below string:

{{Ship|prefix|name|hull number}}

For example, to create HMS Vanguard (S28) (which is automatically linked to HMS Vanguard (S28)), insert


Or, to create USS Nimitz (CVN-68) (linked to USS Nimitz (CVN-68)), insert


The Tom 17:14, 25 August 2005 (UTC)

Main page usage[edit]

Shouldn't this template be protected, since it is transcluded onto the main page? A•N•N•Afoxlover hello! 20:42, 29 March 2007 (UTC)


You may want to use {{USS}} or {{HMS}}. They are a bit shorter to type, and now offer some (optional) flexibilty about what to display.

 {{Ship|USS|Enterprise|CVN-65}} would be equal to {{USS|Enterprise|CVN-65|6}}.

It really gets shorter if you want to display the hull number, such as HMS Repulse (1916) from.


More reasoning on Template talk:USS. --J Clear 23:20, 22 April 2007 (UTC)

Apparently Meaningless Terminal 6[edit]

In the example {{USS|Enterprise|CVN-65|6}}, the final '6' has meaning? If so, what?

Yours utterly baffled.--Toddy1 20:42, 27 September 2007 (UTC)

Option 6 looks like a feature used in {{HMS}} and {{USS}}, but not in this template. --Kralizec! (talk) 00:51, 28 September 2007 (UTC)

Feature request[edit]

The question above from Toddy1 (talk · contribs) got me thinking. Could someone with a better understanding of template parser functions add some of the functionality of {{HMS}} and {{USS}} into this template? Specifically I feel the following optional display control parameters would be very useful (note that #6 below works as the default on HMS/USS, while option #6 on HMS/USS works as the default on {{warship}}):

Template usage Equivalent wikicode Final result
{{Ship|Russian battleship|Petropavlovsk|1914|2}} [[Russian battleship Petropavlovsk (1914)|''Petropavlovsk'']] Petropavlovsk
{{Ship|HMCS|Kootenay|H75|1}} [[HMCS Kootenay (H75)|H75]] H75
{{Ship|SMS|Oldenburg|1910|6}} [[SMS Oldenburg (1910)|SMS ''Oldenburg'' (1910)]] SMS Oldenburg (1910)
{{Ship|French submarine|Le Redoutable|S 611|5}} [[French submarine Le Redoutable (S 611)|French submarine (S 611)]] French submarine (S 611)

Thoughts? Suggestions? Volunteers? Smiley.svg --Kralizec! (talk) 01:35, 28 September 2007 (UTC)

Transclusion cost/benefit?[edit]

I recently edited the Tribal class destroyer (1936) page to replace many confusing links to vessels with this template, however these were reverted shortly afterward and the editor pointed me toward the Wikipedia:Transclusion costs and benefits while noting on my talk page that this template is too taxing for server processing. Does anyone have any thoughts about this? I would argue that the benefits of standardizing and simplifying links to articles on vessels, not to mention the kilobytes saved, would trump any minuscule increase in server effort....Thanks! Plasma east 15:29, 16 November 2007 (UTC)

If I may make a suggestion ... bring this up at the WP:SHIPS talk page. That ways it will be seen by heaps more eyes! --Kralizec! (talk) 15:38, 16 November 2007 (UTC)


I've asked TomTheHand to modify this template's syntax to include the optional display parameters used in {{HMS}}, {{USS}}, and {{USNS}}. To bring this template in agreement with the others, after the change, the default output will display the prefix, name, and pennant/hull number. (This change of default output will not adversely affect existing articles, as the syntax of preexisting transclusions will be modified to produce the same output as before.) More important, of course, is that you'll be able to control display using parameters that are familiar from our other templates. Maralia (talk) 15:20, 17 December 2007 (UTC)

I posted the following to Maralia's talk, but figured I'd post it here too to get better exposure. Please give feedback! Once we're all satisfied I'll copy it from my user space to here.

I've done a little work on the {{warship}} issue, but I've run into some problems. First, the good news:

Template usage Equivalent wikicode Final result
{{User:TomTheHand/warship|USS|Enterprise|CVN-65}} [[USS Enterprise (CVN-65)|USS ''Enterprise'' (CVN-65)]] User:TomTheHand/warship
{{User:TomTheHand/warship|HMCS|Kootenay|H75|6}} [[HMCS Kootenay (H75)|HMCS ''Kootenay'']] User:TomTheHand/warship
{{User:TomTheHand/warship|HMCS|Ottawa|H60|3}} [[HMCS Ottawa (H60)|''Ottawa'']] User:TomTheHand/warship
Essentially, if you supply it with a prefix, ship name, and classification symbol, you can then use the same spiffy output configuration options as in {{USS}}.
Now, the bad news:
Template usage Equivalent wikicode Final result
{{User:TomTheHand/warship|Japanese battleship|Yamato|2}} [[Japanese battleship Yamato (2)|Japanese battleship ''Yamato'' (2)]] User:TomTheHand/warship
{{User:TomTheHand/warship|Japanese battleship|Yamato|4=2}} [[Japanese battleship Yamato|''Yamato'']] User:TomTheHand/warship
You can't just supply it with a prefix, a ship name, and an output type. The third parameter you pass in is interpreted as the classification symbol. You've got to specifically set the fourth parameter (output type). I'd like for it to accept something more intuitive, like disp=2, but I'm not sure how to do that while still making it automatically understand four parameters if you supply it that way. TomTheHand (talk) 01:56, 18 December 2007 (UTC)
I think this is more intuitive:
{{User:TomTheHand/warship|Japanese battleship|Yamato||2}} produces User:TomTheHand/warship
It's less characters than '4=2' or 'disp=2' also. Maralia (talk) 06:07, 19 December 2007 (UTC)
Oooh... I didn't realize you could do that. Spiffy. Ok, I'll copy the updated template from my user space tonight. TomTheHand (talk) 21:56, 19 December 2007 (UTC)

Change request for parameter audit[edit]


Request that the line


be changed to read

-->]]{{#ifeq:{{{1}}}|HMCS|{{voidd|{{WP Ships HMCS instances}}}}}}</includeonly><noinclude>

This modification would make no visible change to the template's operation, but helps generate a list of occurrences of {{ship|HMCS}}. Cheers. HausTalk 19:12, 1 December 2008 (UTC)

Actually, please use this version of the sandbox template (less the sandbox notice). It incorporates Haus' request plus additional code for tracking the parameters USS, HMS, HMAS, and HMNZS. I have tested the code on the testcases page. This version also eliminates the text that displays on the template page that is now superfluous with the current template documentaion. — Bellhalla (talk) 20:34, 1 December 2008 (UTC)
Done. --Kralizec! (talk) 22:46, 1 December 2008 (UTC)

Links for parameter audits[edit]

Bellhalla (talk) 23:56, 1 December 2008 (UTC)

Edit request[edit]

{{editprotected}} Please update the template to this version in the sandbox (less the sandbox template notice at the top). This eliminates the code snippet:

{{#ifeq:{{{1}}}|HMCS|{{voidd|{{WP Ships HMCS instances}}}}}}{{#ifeq:{{{1}}}|HMAS|{{voidd|{{WP Ships HMAS instances}}}}}}{{#ifeq:{{{1}}}|HMNZS|{{voidd|{{WP Ships HMNZS instances}}}}}}{{#ifeq:{{{1}}}|USS|{{voidd|{{WP Ships USS instances}}}}}}{{#ifeq:{{{1}}}|HMS|{{voidd|{{WP Ships HMS instances}}}}}}

that was intended to track usage of this template with certain prefixes. Example: when USS is used as a prefix, the redlinked template {{WP Ships USS instances}} is transcluded, which, in theory, allows one to determine usage (by looking at "What links here" for use {{WP Ships USS instances}}). Then the specific {{USS}} could be used instead of this, the more generic template. However, since {{USS}} and others of the same functionality already themselves call {{Ship}}, the redlinked template is called for all uses of the prefix whether through {{Ship}} or {{USS}} making it impossible to determine which template was invoked, and making this bit of code unnecessary and needlessly complicating many pages. — Bellhalla (talk) 17:35, 26 January 2009 (UTC)

Done, though if you look at the source code, does the sandbox notice need to be removed as well? Thanks, Woody (talk) 17:52, 26 January 2009 (UTC)
Yes, it should. :) — Bellhalla (talk) 17:58, 26 January 2009 (UTC)
Done, regards, Woody (talk) 18:18, 26 January 2009 (UTC)

Another edit request[edit]

{{editprotected}} Please replace this second line of the template code:

  • -->[[{{{1}}} <!--

with this line:

  • -->{{#if:{{{up|}}}|{{{1}}}&#32;}}[[{{{1}}} <!--

This will add the capability for optional output with the ship prefix unlinked. This is useful for situations where the prefix is of the sort like "Japanese battleship". So if the desired output is:

one will be able to type:

  • {{ship|Japanese battleship|Yamato||2|up=yes}}

rather than:

  • Japanese battleship {{ship|Japanese battleship|Yamato||2}}

The new optional parameter is a named (vs. numbered only) parameter and should not affect any uses of the template unless explicitly invoked. Thanks. — Bellhalla (talk) 17:46, 18 February 2009 (UTC)

Yes check.svg Done, regards, Woody (talk) 18:15, 18 February 2009 (UTC)
Wow. That was fast. Thanks, Woody. — Bellhalla (talk) 18:18, 18 February 2009 (UTC)

Ignore leading/trailing spaces in parameters[edit]

An editor recently accidentally put a space before the second parameter, as in {{ship|Japanese battleship| Musashi }}. This resulted in an extra space being put between "battleship" and "Musashi." While I realize that the error is easily correctable, it would seem desirable to have the code self-correct such errors. Would it be possible for this template to ignore leading spaces in parameters? Mamyles (talk) 22:15, 5 March 2015 (UTC)