Template talk:Infobox service record

Latest comment: 2 years ago by Tamzin in topic Whitespace at the top of ship articles
WikiProject iconMilitary history Template‑class
WikiProject iconThis template is within the scope of the Military history WikiProject. If you would like to participate, please visit the project page, where you can join the project and see a list of open tasks. To use this banner, please see the full instructions.
TemplateThis template does not require a rating on the project's quality scale.
Additional information:
Note icon
No existing task force includes this article in its scope; to propose a new one, please leave a message on the main project talk page.

Use within a ship infobox? edit

I don't know if the bold type for the field names, like "Commanders", "Victories", etc., is standard for other Military infoboxes, but used within ship infoboxes, the bold type stands out from other fields in other templates which are not in bold type. Should the bold type be tied to the "is_ship" field? Also, what about colons after the field names? — Bellhalla (talk) 19:16, 4 November 2008 (UTC)Reply

Yes, the current format is standard in military infoboxes, but it would be fairly trivial to tie it to the ship control field. Just let me know what changes you'd like to take place when it's inside the ship infobox. Kirill (prof) 01:36, 5 November 2008 (UTC)Reply
How about when "is_ship" is yes, make the field text not bold and add a colon at the end so it would be:
  • Victories:
rather than:
  • Victories
Also, could another field with a name along the lines of "is_multi" be added that would eliminate the final "|}" from the template? This would allow the template to be used in a ship infobox more than once or in a location other than the last 'slot' of the infobox, for example. (See Austro-Hungarian submarine U-XI for a manually coded example of why this would be useful.) Having this as a separate field, rather than being tied to "is_ship", would prevent the breakage of many instances already in use in ship infoboxes, but still allow the flexibility to use it as needed. Many thanks in advance. — Bellhalla (talk) 13:11, 6 November 2008 (UTC)Reply
Ok, all done; please let me know if anything doesn't work as it should. Kirill (prof) 13:53, 6 November 2008 (UTC)Reply
It looks like with "is_multi" set to yes that it's generating an extra "}" at the end. Take a look at Austro-Hungarian submarine U-XI (updated with the template) to see what it's doing. As it is now, there are two "}}" at the top of the article. Commenting out one instance generates only one "}". But, wow. That was fast. — Bellhalla (talk) 15:37, 6 November 2008 (UTC)Reply
I got it fixed. Instead of interpreting the last part of the last conditional as "generate |} and close the conditional" it was interpreting it as "generate |, close the conditional, and generate }". I created a subtemplate at Template:Service record/CloseTable that generates the proper table close code and tested it in the template sandbox using test cases here and everything seemed to work. — Bellhalla (talk) 23:41, 6 November 2008 (UTC)Reply

Whitespace at the top of ship articles edit

All ship articles transcluding this template appear to have an extra blank line at the top, before the infobox. Not sure how long this has been an issue. --Paul_012 (talk) 03:10, 3 July 2021 (UTC)Reply

Please remove the line break between lines 3 and 4 (after the end of the <!-- not standalone (in a primary infobox) --> comment), or move the closing comment tag onto the beginning of line 4. The extra new line is causing white space at the top of articles. --Paul_012 (talk) 08:04, 3 July 2021 (UTC)Reply

  Done Good catch, Paul_012! I checked on German submarine U-2 (1935) and this seems to have done the trick, but let me know if this didn't fix it for some reason. The code in question has been in the template for over five years, so it's odd that no one mentioned it... Perhaps there was some change to a transcluded template, or to the parser itself, that caused this to start being an issue. -- Tamzin (she/they) | o toki tawa mi. 08:59, 3 July 2021 (UTC)Reply