Langbahn Team – Weltmeisterschaft

Template talk:Sclass: Difference between revisions

Content deleted Content added
Trappist the monk (talk | contribs)
Line 72: Line 72:
:If one is to believe the edit history, that extra space may have been the result of [[Special:Diff/1123075584|this edit]] by Editor [[User:Jonesey95|Jonesey95]] in an attempt to fix some sort of linter error. What was the error? Can it be fixed some other way?
:If one is to believe the edit history, that extra space may have been the result of [[Special:Diff/1123075584|this edit]] by Editor [[User:Jonesey95|Jonesey95]] in an attempt to fix some sort of linter error. What was the error? Can it be fixed some other way?
:—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 01:08, 25 February 2023 (UTC)
:—[[User:Trappist the monk|Trappist the monk]] ([[User talk:Trappist the monk|talk]]) 01:08, 25 February 2023 (UTC)
::The error appears when {{para|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. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 07:22, 25 February 2023 (UTC)

Revision as of 07:22, 25 February 2023

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.

Hyphenated article / redirect problem

I'm unable to get this template to output a link without a redirect on an article that hyphenates in the name (i.e. Derfflinger-class battlecruiser). Nothing I can come up with will output a link with the hyphen, necessitating a redirect (i.e. Derfflinger class battlecruiser). Can we establish a parameter to change this without screwing up the parser? For the list I'm generating, I can't use a greenlink, I need the actual target instead of a redirect (and really don't want to have to manually type piped links with italics). bahamut0013wordsdeeds 17:25, 16 December 2010 (UTC)[reply]

Yes, please fix this problem. An example is the link in the beginning of Armament of the Iowa class battleship, Iowa class battleship. Wiki code: {{sclass|Iowa|battleship|1}}. --Mortense (talk) 20:39, 21 January 2013 (UTC)[reply]
Yeah, I'm late to the party. {{sclass-}} for italicized class names; {{sclass2-}} for non-italicized class names.
Trappist the monk (talk) 11:59, 15 March 2013 (UTC)[reply]
Still the same problem. If anyone can fix, it'd be much appreciated. Illegitimate Barrister 08:14, 4 January 2015 (UTC)[reply]
Example please?
Trappist the monk (talk) 12:24, 4 January 2015 (UTC)[reply]

Hyphenated article name break template

There is an issue with hyphenated ship class names that breaks the template. For example, {{sclass|Oscar|submarine}} (Oscar-class submarine) creates a link, but the correct link to the hyphenated article name, {{sclass|Oscar-|submarine}} (Oscar--class submarine, article named Oscar-class submarine) fails. — btphelps (talk to me) (what I've done) 08:17, 9 February 2014 (UTC)[reply]

For hyphenated article titles, use {{sclass-}}: Oscar-class submarine.
Trappist the monk (talk) 11:40, 9 February 2014 (UTC)[reply]

Further deprecation of the unhyphened templates

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

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?

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-00000012-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?

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]