Template talk:Redirect template

Visual bug with R avoided double redirect

edit

There is some small visual bug with {{R avoided double redirect}} that I couldn't find it's origin. The bug scenario is this, when using {{R avoided double redirect}} after another redirect template on the same line, the redirect template isn't bulleted correctly. Using Arrow 2.5 as an example: This is ok:

{{Redirect category shell|1=
{{R to section}}
{{R avoided double redirect|1=Arrow: Season 2.5}}
}}

While this has the bug.

{{Redirect category shell|1=
{{R to section}}{{R avoided double redirect|1=Arrow: Season 2.5}}
}}

In this module, here is the relevant code that handles the text:

local content = string.format('\n<div class="rcat %s">\n*%sThis is a redirect%s%s.%s%s</div>',
		args.class or '',
		args.name and getPrettyName(args) or '',
		args.from and (' from ' .. args.from) or '',
		args.to and (' to ' .. args.to) or '',
		args.info and beCompatibleWithBug12974 or '',
		args.info or ''

This module uses string.format to create the string. The second "%s" is probably what is causing the issue. {{R avoided double redirect}} is different than the other redirect templates, as it uses a module, Module:R avoided double redirect, to handle the logic, but it still passes the information like the other redirect templates to {{Redirect template}} with:

  return frame:expandTemplate({title="Redirect template",
                               args={from=from,info=info,["main category"]=cat,
                                     name=(embed=="yes" and "From an avoided double redirect" or nil)}})

The arg.name that is passed to this module, comes from the arg.name here. I couldn't find where this module uses |embed=, so it might be connected to this. --Gonnym (talk) 17:52, 14 December 2019 (UTC)Reply

@Gonnym: Module:Redirect template adds a newline at the beginning to ensure the correct rendering of bullets. The trouble is that in {{R avoided double redirect}}, the call to Module:R avoided double redirect appears as an argument to a parser function. MediaWiki parser strips whitespace characters at the beginning and end of all parser function arguments, as a result the newline added by Module:Redirect template is lost. There is no simple way to fix this, trying to add some invisible char before the #invoke causes 2 newlines to render, which is worse.
But there is one way to fix it -- do we really need this parser function call? {{#ifeq:{{FULLPAGENAME}}|Wikipedia:Template messages/Redirect pages|| ... }} First of all, Wikipedia:Template messages/Redirect pages is now a redirect pointing to Wikipedia:Template index/Redirect pages. So the code doesn't actually do what it's supposed to do. Secondly, that index page is already messy and appears in several maintenance categories. It doesn't seem important to me to have this special condition for that page. I'd suggest removing it. SD0001 (talk) 13:36, 26 February 2020 (UTC)Reply
@SD0001:, if that's the issue there is a simple fix to it with {{If}}, which I've used in Template:R avoided double redirect/sandbox. Regarding the incorrect page name, that should really just be a parameter called |doc=. --Gonnym (talk) 08:06, 27 February 2020 (UTC)Reply
That does it! Didn't know of that one. SD0001 (talk) 10:04, 6 March 2020 (UTC)Reply
To editor SD0001: there is good reason to keep and maintain the exclusion code in the rcat {{R avoided double redirect}}. Since this is the only rcat that invokes a module, it is the only rcat that needs this exclusion code. We want it to appear with the other rcats in the index; however, we don't want the module invoked on the index page, and that is why the exclusion code is used in that rcat. As for the embedding, I vaguely remember a time when embedding was important, but that was long ago, and I no longer know why the embedding was needed. If things work without it, then it probably means that software development has advanced beyond the need for it. PI Ellsworth  ed. put'r there 00:58, 7 March 2020 (UTC)Reply
@Paine Ellsworth: I seem to remember embed parameter became useless following the deprecation of {{This is a redirect}}, the older version of {{Redirect category shell}}. SD0001 (talk) 07:41, 7 March 2020 (UTC)Reply
Good to know, SD0001! I seem to remember a lot of back-to-back software upgrades by the devs around that time. PI Ellsworth  ed. put'r there 13:58, 7 March 2020 (UTC)Reply

"Template:R rcat" listed at Redirects for discussion

edit

  A discussion is taking place to address the redirect Template:R rcat. The discussion will occur at Wikipedia:Redirects for discussion/Log/2021 February 14#Template:R rcat until a consensus is reached, and readers of this page are welcome to contribute to the discussion. 𝟙𝟤𝟯𝟺𝐪𝑤𝒆𝓇𝟷𝟮𝟥𝟜𝓺𝔴𝕖𝖗𝟰 (𝗍𝗮𝘭𝙠) 16:17, 14 February 2021 (UTC)Reply

Template-protected edit request on 12 December 2021

edit

Sync with Module:Redirect template/sandbox. This adds an optional |sortkey= parameter (which would be useful for rcat templates like {{R country data}} where the sortkey is something that is generally well known. –MJLTalk 19:05, 12 December 2021 (UTC)Reply

  Done @MJL: see 1060814851Uzume (talk) 20:59, 17 December 2021 (UTC)Reply

Categorize templates based on namespace(s)

edit