Template talk:Sclass

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
WikiProject iconShips Template‑class
WikiProject iconThis 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, or contribute to the project discussion. All interested editors are welcome. To use this banner, please see the full instructions.WikiProject icon
TemplateThis template does not require a rating on Wikipedia's content assessment scale.

Further deprecation of the unhyphened templates[edit]

I have updated the code for deprecated templates {{sclass}}, {{sclass2}}. I have added some extra's to make deprecation more easy.

How to deprecate. In the long run, templates {{sclass}}, {{sclass2}} should be replaced by the hyphenated {{sclass-}}, {{sclass2-}}. Core difference is that the hyphen-templates create a link to a hyphened page:

{{sclass |Constellation|frigate}} links to Constellation class frigate
{{Sclass|Constellation|frigate}} links to Constellation-class frigate

In both templates (hyphened/unhyphened), the text shown for the link is the same: hyphened.

In non-mainspace pages. The replacement is not possible in pages like archives, userpages and talkpages. For this reason, I have created separate code that serves these deprecated templates, and can stay there untouched forever: Template:Sclass/core/deprecated. With this, those pages will show the old {{sclass}} as ever. They are not listed in maintenance categories, because there is no maintenance to be done. Then new {{sclass-}} code can develop further without having to keep old requirements in mind.

When replacing is bad. Meanwhile these templates should be removed from mainspace (at the moment, some 1100 transclusions are in mainspace). But blind replacement can have this disadvantage: when the old template shows a blue link, the new one may show a red link. This is undesired, and requires editor's action. In short, we should create the blue hyphened link, and then replace.

Categories and warnings. Maintenance messages and categorisation only happens in mainspace, the other spaces are supposed to stay unchanged (cannot do maintenance there). These "potential blue link to red link changes" are categorised in Category:WPSHIPS: sclass hyphenated red link (0). Also, an article with the old template will show a warning in Preview when this is the case. (No warning says: old {{sclass}}s can be replaced without damage). The maintenance categories are together in Category:WPSHIPS: sclass deprecation (0)

-DePiep (talk) 21:48, 21 March 2018 (UTC)[reply]

Checks to salvage blue links over red links has been removed: too expensive. Currently probably under a dozen btw, no big loss. - DePiep (talk) 16:52, 22 March 2018 (UTC)[reply]

Category:Pages with too many expensive parser function calls[edit]

after recent changes by DePiep, Naval warfare of World War I and Naval history of World War II are now in Category:Pages with too many expensive parser function calls and Category:Pages with script errors. Frietjes (talk) 14:34, 22 March 2018 (UTC)[reply]

Looking at this. - DePiep (talk) 15:01, 22 March 2018 (UTC)[reply]
 Fixed -- removed expensive, secondary checks (after making use of them first ;-) ). - DePiep (talk) 16:50, 22 March 2018 (UTC)[reply]

Template issue?[edit]

This template is used for a pair of ships in a hatnote on Nilgiri-class frigate (2019), but for some reason the italics are reversed for both (ie: Foo-class). FYI - wolf 00:11, 12 April 2021 (UTC)[reply]

Not an issue. The hatnote italicizes everything unless overridden as it is in the italic markup from the {{sclass}} template rendering:
{{hatnote|For the namesake {{Sclass|Leander|frigate|0}} predecessors, see {{Sclass|Nilgiri|frigate (1972)|1}}}}
renders this:
'"`UNIQ--templatestyles-0000000F-QINU`"'<div role="note" class="hatnote navigation-not-searchable">For the namesake [[Leander-class frigate|''Leander''-class]] predecessors, see [[Nilgiri-class frigate (1972)|''Nilgiri''-class frigate (1972)]]</div>
The hatnote css class applies font-style: italic (line 1000 in MediaWiki:Common.css). The italic wikimarkup produced by {{sclass}}, overrides the italics to flip the wrapped text to normal font style (line 1004). This is what we want because we want the ship-class name to be a different font style from that of the local running text – to be visually distinct. In normal running text the ship-class name is italicized so in italic running text we want the ship-class name to be normal font.
Trappist the monk (talk) 00:48, 12 April 2021 (UTC)[reply]
Ah of course, that makes sense. Thanks - wolf 01:30, 12 April 2021 (UTC)[reply]

Why does the template generate a leading space?[edit]

It's annoying and causes the appearance of double spacing. Am I missing something? RadioactiveBoulevardier (talk) 00:35, 25 February 2023 (UTC)[reply]

If one is to believe the edit history, that extra space may have been the result of this edit by Editor Jonesey95 in an attempt to fix some sort of linter error. What was the error? Can it be fixed some other way?
Trappist the monk (talk) 01:08, 25 February 2023 (UTC)[reply]
The error appears when |1= is absent, resulting in six ' marks in a row. It could be fixed with an if statement or possibly a zwsp. Be my guest. – Jonesey95 (talk) 07:22, 25 February 2023 (UTC)[reply]
That would be four not six, right? Fixed by changing '' {{{1}}}'' to {{#if:{{{1|}}}|''{{{1}}}''}}.
+{{sclass|Benjamin Franklin|submarine}}+
+[[Benjamin Franklin-class submarine|''Benjamin Franklin''-class]] [[submarine]]+
+Benjamin Franklin-class submarine+
Trappist the monk (talk) 15:11, 25 February 2023 (UTC)[reply]

Not sure what, but something with this template has broken this Featured topic box. Harrias (he/him) • talk 13:36, 4 April 2023 (UTC)[reply]

No. The template is not broken, the call to the template is broken: {{sclass|König|battleship|6}}. The value assigned to positional parameter 3 (6) is not a valid value (which is pretty much what the error message says). Choose an appropriate value. Did the help link not explain this well enough?
Trappist the monk (talk) 14:14, 4 April 2023 (UTC)[reply]
Not my template, not my topic box. I saw it not working, assumed it had before, and so posted it here thinking it was a template issue. If someone has just screwed up the coding, fair enough. Harrias (he/him) • talk 21:39, 5 April 2023 (UTC)[reply]