Template talk:Height

(Redirected from Template talk:Height/sandbox)
Latest comment: 6 years ago by Frietjes in topic Error handling

Created for sports articles, to indicate how tall a player is.

Add "sort" ability to template

edit

If this template is used in a table, then it does not sort properly. That is, it will sort values like this:

  • 6 ft 0 in
  • 6 ft 10 in
  • 6 ft 2 in

Can we add the ability to sort on the metric unit of the value so that it is sorted properly? — X96lee15 (talk) 18:13, 22 December 2015 (UTC)Reply

The simplest might be to use {{convert}} for more tricky cases because convert handles sortable tables and some other things that might be useful. See Help:Convert#Sortable table for a table example. Examples:
  • {{convert|192|cm|ftin|abbr=on}} → 192 cm (6 ft 4 in)
  • {{convert|192|cm|ftin|1|abbr=on}} → 192 cm (6 ft 3.6 in)
  • {{convert|192|cm|ftin|abbr=on|frac=2}}192 cm (6 ft 3+12 in)
  • {{convert|6|ft|3+1/2|in|cm|0|abbr=on}}6 ft 3+12 in (192 cm)
  • {{convert|192|cm|ftin|abbr=on|frac=2|order=flip}}6 ft 3+12 in (192 cm)
Using |sortable=on adds a sort key, and the sort key can be displayed using debug=yes:
  • {{convert|192|cm|ftin|abbr=on|frac=2|sortable=on|debug=yes}}7000192000000000000♠192 cm (6 ft 3+12 in)
Johnuniq (talk) 00:06, 23 December 2015 (UTC)Reply

Output in cm?

edit

I've never lived anywhere where the height of people is measured in metres rather than centimetres (I'm Canadian and live in Japan). Why does this template force output in metres—especially given it accepts input in centimetres? Curly "JFC" Turkey 🍁 ¡gobble! 02:52, 20 February 2017 (UTC)Reply

I don't know, but the "See also" has some convert examples that output in cm so I guess it is hinting to use {{convert}} for that (by the way, height calls convert to do the work now). In case you are not aware, some infoboxes no longer want a template—you just enter something like "5 ft 8 in" and it magically works out what to do. Johnuniq (talk) 03:30, 20 February 2017 (UTC)Reply
Thanks! That's a better solution. Curly "JFC" Turkey 🍁 ¡gobble! 03:44, 20 February 2017 (UTC)Reply
It's a very good question. One that keeps getting asked again, and again, and again...--45.72.141.216 (talk) 03:14, 4 May 2017 (UTC)Reply
The template now allows |out=cm to output conversions from feet and inches to centimetres. Example: {{height|ft=6|in=1|out=cm}} will display 6 ft 1 in (185 cm). More examples can be found in the documentaton. It was made optional to avoid affecting of any current uses of the template. Values other than "cm" are ignored, so |out=m has no effect but could used: {{height|ft=6|in=1|out=m}} will display 6 ft 1 in (1.85 m) (similar to how |mf=y is used with the {{birth date}} templates). -- Zyxw (talk) 03:02, 16 August 2017 (UTC)Reply

Talk:List of average human height worldwide

edit

I'd asked this years ago on the Talk:List of average human height worldwide, but I tend to recall the template being able to do conversions down to the quarter-inch, and I'd really like that to happen again on the Talk:List of average human height worldwide. Is this possible? --Criticalthinker (talk) 11:36, 8 February 2018 (UTC)Reply

Talk:List of average human height worldwide#Conversion has an example in the reply:
  • {{height|cm=177|frac=16}}177 cm (5 ft 9+1116 in)
It might be better to use {{convert}} directly as that is understood by many editors and is used to do the work by {{height}}. If wanted, {{cvt}} (which is convert with abbr=on) examples would be:
  • {{cvt|177|cm|in|frac=4}}177 cm (69+34 in)
  • {{cvt|177|cm|ftin|frac=4}}177 cm (5 ft 9+34 in)
Johnuniq (talk) 22:05, 8 February 2018 (UTC)Reply
I'd have no idea how to do this on that page. More than that, is this something I'd have to ask to do? I would like someone with the know-how to do this. --Criticalthinker (talk) 00:34, 9 February 2018 (UTC)Reply
I don't understand that. If you are editing an article and want to use {{height}} and want it to display a fraction, use |frac=4 (or |frac=2 or other number) as shown above. If you want to change the default behavior of this template, please spell out what you want. Johnuniq (talk) 03:09, 12 February 2018 (UTC)Reply

Error handling

edit

I noticed today that Height has not been displayed in the infobox for Geva Mentor for 5 months due to this edit which introduced {{height|1.90m}}. This is an obvious error in template usage, but the editor did not notice that nothing was displayed in the infobox and there was no warning. Not sure if there are many more of these out there. Can this generate an error or be flagged in a maint category or something? MB 14:12, 26 September 2018 (UTC)Reply

I added Category:Pages using height with unknown parameters, which will take some time to fill up. we can remove this tracking if for some reason it's too much overhead. Frietjes (talk) 19:19, 26 September 2018 (UTC)Reply