Template talk:Abbr

About this board

Parameters backwards?

8
Summary by FeRDNYC

The documentation, which had been borrowed from en:Template:Abbr/doc, didn't match the different parameter order of this wiki's template code. The documentation has been updated to correctly document the (unusual) parameter ordering unique to the local Template:Abbr.

FeRDNYC (talkcontribs)

As far as I can tell, either the documentation has this template's parameters backwards, or the template is coded backwards. The way it's written, the acronym is the second parameter, whereas the expansion that goes into <abbr title="">is the first parameter. (Which seems very strange; I would expect it the other way around, as documented. ...But fixing it risks breaking every transclusion on the site, assuming they're currently using the "correct" backwards parameters.)

PerfektesChaos (talkcontribs)

You are right.

  • The entire thing is apparently supposed to be based upon w:en:Template:Abbr.
  • However, on establishing here in 2011 the parameter order was the other way around, 1=tooltip and 2=term which is always visible.
  • The thing was never documented.
  • All existing transclusions here are using the local sequence, I guess. Several thousands, I am afraid.
  • Then, in April 2020 but not on April fools day a smart guy showed up and left a copy of English Wikipedia template documentation within the programming page, not within a /doc subpage. The way English Wikipedia is solving problems is the best way it can be done, and every other wiki has to do things exactly in the same way English Wikipedia is doing that.
  • Now we have a mismatch between documentation and programming.
  • And we have an unknown number of transclusions relying on the parameter order as of 2011, and some relying on the parameter order as documented since 2020.

Enjoy.

FeRDNYC (talkcontribs)

OK, I moved the documentation to Template:Abbr/doc, fixed the parameter ordering in the explanation and the TemplateData, added a big scary warning about the reversed parameters, and fleshed the docs out some with examples and more metadata. I also re-borrowed some more of the en:Template:Abbr/doc content, as it's still very much applicable. (Things like the "Linking must be done a particular way" explanation.

I thought of a way we actually could go about fixing the parameters, though it's questionable whether it's worth the bother.

  1. First, create Template:Abbr2 or Template:AbbrEversed or whatever, as a redirect to Template:Abbr.
  2. Run a bot to replace all {{Abbr}} transclusions with transclusions of the redirect.
  3. Once it's done, break the redirect and move Template:Abbr to Template:Abbr2
  4. At that point we're free to write a new Template:Abbr so it works the right way around.

Even if we did everything that carefully, we'd still have all of the bot-rewritten transclusions that actually use the (previously-)documented en:Template:Abbr parameter order to deal with.

PerfektesChaos (talkcontribs)

@FeRDNYC: Usually, such things are remedied in a different way:

  1. Do not create a new template.
  2. Introduce two named parameters as first meaning.
  3. Keep the current, traditional, unnamed, numerical parameters as aliases and fallback of the named ones.
  4. Investigate by a random inspection how often old or reversed order are occurring, and modify immediately those transclusions.
  5. Run a bot if apparently a very wide majority is using one particular interpretation.
  6. Create a class="error" warning and show plain parameter values if someone is using any unnamed parameter; and remove aliases from /doc.
FeRDNYC (talkcontribs)

@PerfektesChaos: While I agree that makes sense in the majority of cases, part of the issue here is the local Template:Abbr failing to follow established syntax used by (should-be-)equivalent templates like en:Template:Abbr. Adding named parameters really doesn't address that issue.

FeRDNYC (talkcontribs)

It may not really matter, anyway. It looks like, despite their vast number, nearly all of the current Template:Abbr transclusions are actually indirect uses, due to the transclusion of {{MWReleases}}. Which may be just about the only actual use of {{Abbr}} anywhere on the wiki.

({{MWReleases}}, for the record, was for the longest time using the incorrect (documented, Wikipedia-standard) syntax, but has recently been corrected to use the local Template:Abbr's backwards parameters.)

PerfektesChaos (talkcontribs)

It will abolish to use any unnamed parameter in future, after bot run has corrected the existing transclusions, hopefully as intended.

  • If anybody will show up in future with any unnamed parameter they will receive a warning and both values as plain text are displayed.
  • That might be local inhabitants who always used 1=this and 2=that.
  • That might be someone who copied a paragraph from enWP and did not notice the local change.

It is a solution of the entire problem, since the ambiguous old-fashioned approach with unnamed parameters is terminated and shall not be supported any longer.

  • The situation is quite typical for old templates in 2005 style, since unnamed parameters are ambiguous by nature.
  • Modern insertions might use VE and other tools and do not know any parameter name used in programming. They just provide the data in form fields and fine.
FeRDNYC (talkcontribs)
Reply to "Parameters backwards?"
There are no older topics