Template talk:Number and percent

(Redirected from Template talk:Percent and number)
Latest comment: 8 years ago by Frietjes in topic Extra features

Extra features

edit

This template is very useful, but could you please add some of these "extra" features:

a. The template should be able to ignore commas in the numbers so that it does not display error messages. There are several data columns in tables that have commas in them (like for those in population) and it is quite tedious to remove all of them.

b. The option to flip the order of the cells in the table (like using order=flip as used in {{convert}}) so that the percentage is in the left column and the number is on the right.

c. Option to add padding zeroes (like using pad=1 in {{percentage}}), so that the table entries are aligned during sorting.

Thanks. Sanglahi86 (talk) 12:42, 13 April 2016 (UTC)Reply

Sanglahi86, it sounds like you haven't tried using it yet? I will work on the flip option, but the others are inherited from {{percentage}}. Frietjes (talk) 14:54, 13 April 2016 (UTC)Reply
Hello, sorry, I did not know it was inherited from {{{percentage}}}. I previewed the template in my sandbox earlier, and the first preview gave an error on all cells when the commas were present. Now, I previewed again the numbers with commas and it is already surprisingly fine. I also misunderstood; I thought padding zeroes wasn't supported since it wasn't included in the documentation. Thank you for looking into the flip option. I was about to use the template in the Antique (province) article, but the table footer wouldn't look very good unless the columns are flipped. Sanglahi86 (talk) 15:19, 13 April 2016 (UTC)Reply
Sanglahi86, rather than add |flip=, I created {{percent and number}} to keep the code complexity lower. Frietjes (talk) 16:27, 13 April 2016 (UTC)Reply
I have tested the new template you created and it works perfect. I will use it to simplify similar tables like that of Antique province. Thank you very much for the time and effort. Sanglahi86 (talk) 17:15, 13 April 2016 (UTC)Reply

Is it possible to use disp=br() like the one used in {{convert}}? It could also be useful for tables if the cell vertical space is big enough like in this article table (under Population).

Sanglahi86, yes, added. Frietjes (talk) 23:04, 11 May 2016 (UTC)Reply