Template talk:Convert/Archive February 2019

Return hidden sortkey only?


Convert can add a table sortkey like this:


 * → &lt;span style="display:none">7001100000000000000 &lt;/span>10 metres (33&amp;nbsp;ft); shows like: 10 m

Is it possible to have the key returned, but nothing else (no visible text)?

I'd like to use that in a table, so I can manipulate the actual visible value while having the right sortkey in there. Or should I go to Lua and approach the module? (could not find this in Val either). -DePiep (talk) 14:16, 31 January 2019 (UTC)
 * Solved otherwise. Situation has same unit everywhere, so I can use ntsh. No need to go to basic SI units (no prefixes). -DePiep (talk) 16:10, 31 January 2019 (UTC)
 * I don't think convert can help with that. Johnuniq (talk) 22:55, 31 January 2019 (UTC)
 * String templates and modules can be applied to the output of templates but it often has to rely on the formatting of the output and may fail after changes. Using Module:String:  selects the span with the sortkey and discards the rest. According to Special:ExpandTemplates,   currently produces   and not what Template:Convert claims. With my code it produces  . Don't try this directly in articles. If it's done with a template then there is only one place to fix if it starts to fail. I don't know a current template which does it. PrimeHunter (talk) 03:10, 1 February 2019 (UTC)
 * or: first to basic SI unit(s) (no prefixes), also set number to get output number only, then feed that number into  ntsh:
 * &rarr; 5 km/h &rarr; . (Maybe use NaN ). -DePiep (talk) 07:26, 1 February 2019 (UTC)

Mark rounding in output?
1852 m‬ gives: 1852 m, with the correct number of significant figures. Is there a template parameter that would give: 1,852 metres (≈6076 ft). Maybe this isn't necessary? Is there any WP policy requiring indication of rounding? I came across this in article about the linear unit the nautical mile, where the exact conversions might be of interest. --Cornellier (talk) 00:01, 15 February 2019 (UTC)
 * Convert might not be suitable for some special situations and I wouldn't worry about having hard-coded values in the article. However, it is possible to match the text currently displayed:
 * → 1,852 m
 * Johnuniq (talk) 02:54, 15 February 2019 (UTC)