Template talk:Sclass: Difference between revisions
Thewolfchild (talk | contribs) →Template issue?: new section |
|||
Line 103: | Line 103: | ||
:Looking at this. - [[User:DePiep|DePiep]] ([[User talk:DePiep|talk]]) 15:01, 22 March 2018 (UTC) |
:Looking at this. - [[User:DePiep|DePiep]] ([[User talk:DePiep|talk]]) 15:01, 22 March 2018 (UTC) |
||
::{{fixed}} -- removed expensive, secondary checks (after making use of them first ;-) ). - [[User:DePiep|DePiep]] ([[User talk:DePiep|talk]]) 16:50, 22 March 2018 (UTC) |
::{{fixed}} -- removed expensive, secondary checks (after making use of them first ;-) ). - [[User:DePiep|DePiep]] ([[User talk:DePiep|talk]]) 16:50, 22 March 2018 (UTC) |
||
== 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 - [[User:Thewolfchild|<span style="color: black">wolf</span>]] 00:11, 12 April 2021 (UTC) |
Revision as of 00:11, 12 April 2021
![]() | Ships Template‑class | ||||||
|
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)
- 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)
- Still the same problem. If anyone can fix, it'd be much appreciated. Illegitimate Barrister 08:14, 4 January 2015 (UTC)
- Example please?
Edit request
This is a copy of a request that I placed at WT:SHIPS. That request has gone unanswered for more than a fortnight. So:
- I have finished the
{{sclass}}
family of templates. The newest and last member of the family is{{sclass2-}}
for use with hyphenated article titles when the ship class is named for a common attribute:{{sclass2-|Flower|corvette}}
produces: Template:Sclass2-.
- In the relatively recent past, the
{{sclass}}
family of templates was nominated for deletion because the original templates{{sclass}}
and{{sclass2}}
and the new{{sclass-}}
templates were all forks - copies of the original{{sclass}}
. Because of that, I created{{sclass/core}}
which does all of the formatting for the four templates. Two of the templates,{{sclass-}}
and{{sclass2-}}
use{{sclass/core}}
while the other two do not.{{sclass}}
and{{sclass2}}
are protected so I can't replace them with the sandbox versions that use{{sclass/core}}
.
- Test cases for all of the
{{sclass}}
templates are at the testcases page. Are there any admins who would be willing to move{{sclass/sandbox}}
to{{sclass}}
and{{sclass2/sandbox}}
to{{sclass2}}
?
—Trappist the monk (talk) 16:22, 7 March 2013 (UTC)
Done. Is there intended to be more work in consolidating these? Chris Cunningham (user:thumperward) (talk) 11:21, 19 March 2013 (UTC)
- Thanks. Given my limited experience with templates, if there is a way that they can be further consolidated, I don't know what that is. Have you got an idea for further improvements?
- Well, if {{sclass/core}} is doing all the grunt work here, do we really need to have four templates to call it? Could we not delete those four and just use {{sclass/core}} directly on articles? Chris Cunningham (user:thumperward) (talk) 12:39, 19 March 2013 (UTC)
- It was my original intent to create a single template that could somehow know "how it was called" – probably through redirects. So,
{{sclass}}
,{{sclass2}}
,{{sclass-}}
, and{{sclass2-}}
would somehow all call some common template. I imagined, and hoped that template parameter{{{0}}}
could be read as the name of the calling template. After all if in{{sclass-|Valiant|tugboat}}
Valiant
is parameter{{{1}}}
andtugboat
is parameter{{{2}}}
doesn't it infer thatsclass-
is parameter{{{0}}}
?
- It was my original intent to create a single template that could somehow know "how it was called" – probably through redirects. So,
- Apparently that isn't the case. I created
{{sclass/core}}
after it was suggested to me at WT:VPT. This is how all of the CS1 citation templates work.
- Apparently that isn't the case. I created
- Heh: it had never occurred to me to use the shell scripting convention of parameter 0 being the template name. That would actually be extremely helpful: maybe file a MediaWiki bug? Chris Cunningham (user:thumperward) (talk) 15:29, 19 March 2013 (UTC)
Edit request #3
This request applies to {{sclass}}
and {{sclass2}}
.
I recently changed {{sclass/core}}
to support an unnamed fifth parameter used to disambiguate ship class names. Two other members of the {{sclass}}
template family, {{sclass-}}
and {{sclass2-}}
, have already been upgraded to use the new version of {{sclass/core}}
.
{{sclass/sandbox}}
and {{sclass2/sandbox}}
have been modified and configured to use the live version of {{sclass/core}}
. All that is required is to copy the contents of {{sclass/sandbox}}
to {{sclass}}
and copy the contents of {{sclass2/sandbox}}
to {{sclass2}}
.
There is a common test cases page for all four of the templates.
Thank you.
—Trappist the monk (talk) 14:04, 5 May 2013 (UTC)
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)
- For hyphenated article titles, use
{{sclass-}}
: Template:Sclass-.
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)
- 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)
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)
- Looking at this. - DePiep (talk) 15:01, 22 March 2018 (UTC)
Fixed -- removed expensive, secondary checks (after making use of them first ;-) ). - DePiep (talk) 16:50, 22 March 2018 (UTC)
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)