Page MenuHomePhabricator

VisualEditor: Template parameters should be in TemplateData recommended order
Closed, ResolvedPublic

Description

Several users on the English Wikipedia, most recently Salix, have requested that the parameters for templates should be in the recommended order not alphabetical order.

For example in {{tracklist}} it lists "Track10" before "Track2", and in the various citation templates, "First" and "Last" should be adjacent.


Version: unspecified
Severity: enhancement

Details

Reference
bz51930

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 2:07 AM
bzimport set Reference to bz51930.

An example of this is {{Taxobox}} which has 100+ parameters. There are about 10 recommended parameters which go at the top the list and the rest of the parameters have a strict ordering depending on taxonomic hierarchy. Kingdom, Phylum, Class, Order, Family, Subfamily, Genus, Species. An example of use is http://en.wikipedia.org/wiki/Formica which gives the fields in a confusing alphabetial order (latin names are used for the fields).

A second problem is the order when no templatedata is specified. In the article http://en.wikipedia.org/wiki/Where_Does_This_Door_Go?veaction=edit
if you open up the dialog for the {{tracklist}} the parameters are listed in the order track1, track10, track11 ... track15 track2 track3 ... track9. Ideally they would be in strict numerical ordering. This would require a smarter sorting algorithm than just alphabetical.

Another note is that case insensitive sort is better than case sensitive sort as templates often have the same parameter with different capitalization, 'Image' and 'image'.

Another example is [[pl:Template:Związek chemiczny infobox]] on pl.wp (infobox for chemical compounds) which has a lot of parameters which should be shown together, but which are not always alphabetically one after another. These groups are for example:

  • gęstość + gęstość źródło + stan skupienia w podanej g + g warunki niestandardowe (density, source for density, state of matter for this density, non-standard environment conditions for the density)
  • rozpuszczalność w wodzie + rww źródło + rww warunki niestandardowe (solubility in water, source, non-standard environment conditions)

There is no such thing as "TemplateData recommended order"; the JSON block is unordered and can't be relied upon. Does this imply that we should have a "parameter order" value for TemplateData?

There is a good case for imposing some ordering on the template parameters. Often you find some parameters naturally group together. Take for example http://en.wikipedia.org/wiki/Template:Infobox_single/doc There are various parameters which group together:
*Ones relating to the image (Cover, Alt, Caption and Border)
*Ones to do with the single chronology (Last single, This single, Next single)
for infoboxes a prefered order would generally be the order they appear in the template.

(In reply to comment #4)

There is a good case for imposing some ordering on the template parameters.
Often you find some parameters naturally group together. Take for example
http://en.wikipedia.org/wiki/Template:Infobox_single/doc There are various
parameters which group together:
*Ones relating to the image (Cover, Alt, Caption and Border)
*Ones to do with the single chronology (Last single, This single, Next
single)
for infoboxes a prefered order would generally be the order they appear in
the
template.

Yeah, that sounds a totally reasonable thing to add. Making a bug now…

  • Bug 53891 has been marked as a duplicate of this bug. ***

The dependency has been fixed.

Is the importance of this still "Low enhancement"?

After filling/testing a couple of templates in ca.wikipedia.org, it looks like the current behavior is the following:

  • Required fields are sorted by the order they are listed in the template data.
  • Optional files are sorted alphabetically.

Please sort everything following the same sequence used in the template data. Usually this is the same order used in the "old" documentation, which in turn tends to follow the order in which the information is presented.

Resolved in Ic3eb665389380c8e3dd6562b059c2f6655a22588

Change 107428 had a related patch set uploaded by Trevor Parscal:
Use paramOrder data for ordering template parameters

https://gerrit.wikimedia.org/r/107428

Change 107428 merged by jenkins-bot:
Use paramOrder data for ordering template parameters

https://gerrit.wikimedia.org/r/107428