Template talk:Row numbers

Requested move 28 April 2018

 * The following is a closed discussion of a requested move. Please do not modify it. Subsequent comments should be made in a new section on the talk page. Editors desiring to contest the closing decision should consider a move review. No further edits should be made to this section. 

No consensus. See no general agreement to rename this template as proposed; however, since there is the possibility of confusion, this template will be moved to Row indexer, the creator's next choice. As is usual with this type of outcome, any editor at any time can open a new RM to garner consensus for a better template name. Have a Great Day and Happy Publishing! (nac by page mover)  Paine Ellsworth   put'r there  01:35, 17 May 2018 (UTC)

Template:Row counter → Template:Autoincrementing table – To avoid confusion with Template:Table row counter &#123;&#123;3x&#124;p&#125;&#125;ery (talk) 14:45, 28 April 2018 (UTC) --Relisting. --  Dane  talk  15:54, 5 May 2018 (UTC) You could just boldly move it. I'm sure of you select a reasonable name, no one will object. - the WOLF  child  00:46, 10 May 2018 (UTC)
 * Oppose - if anything, the other template should be renamed. It's really of no use now, especially with this new one that does the job so much better. - the WOLF  child  15:52, 28 April 2018 (UTC)
 * I think that you are confused.  counts the number of rows in an existing wikitable and reports that number.  That is a completely different sort of task from the task that  performs.
 * —Trappist the monk (talk) 19:24, 28 April 2018 (UTC)
 * But you still have to add all the numbers manually with other one, whereas this one one does it automatically, no? But whatever, you created It, if you think it should be renamed, then so be it. - the WOLF  child  20:05, 28 April 2018 (UTC)
 * Of course, look at how is used.  Its documentation says nothing about 'numbering' table rows, it only counts them.  So, in a page that has a single table which has 4 rows,  returns the single digit number '4'.  That's all.  Nothing about it is intended to add numbering to a table.
 * —Trappist the monk (talk) 21:34, 28 April 2018 (UTC)
 * Take the question to TfD. RM is not the right crowd for it. —SmokeyJoe (talk) 16:00, 9 May 2018 (UTC)
 * What? That doesn't make sense. I'm not trying to get either template deleted, just to make their names easier to distinguish from eachother. &#123;&#123;3x&#124;p&#125;&#125;ery (talk) 18:54, 9 May 2018 (UTC)
 * Most likely, SmokeyJoe simply intends to make the point that this discussion is not getting much participation based upon its listing at Requested moves because editors who tend to frequent WP:RM are not necessarily familiar with the more technical aspects of templates and their uses. RM is a valid venue for this discussion, but without some central notification for template editors the discussion is going to end up relying mainly upon editors who have this template on their watchlists already, or just end up being closed soon. If there is a place to notify template-oriented editors of this discussion, I'd recommend it. Perhaps Wikipedia talk:WikiProject Templates? Dekimasu よ! 00:25, 10 May 2018 (UTC)
 * Yes, I mean advertise. Maybe post at WT:TfD? Given the “Oppose”, don’t do a bold move. —SmokeyJoe (talk) 01:08, 10 May 2018 (UTC)
 * Now that the template is at WP:RM, a bold move is probably inappropriate. I don't particularly see much need for a move but if it must be moved, perhaps  or.
 * —Trappist the monk (talk) 01:12, 10 May 2018 (UTC)


 * The above discussion is preserved as an archive of a requested move. Please do not modify it. Subsequent comments should be made in a new section on this talk page or in a move review. No further edits should be made to this section.

Template doesn't work (at all) on mobile app
Even though this template seems to work fine on the desktop and mobile browser versions, it fails to work at least on the Wikipedia app for Android. Instead of a table, the plain wikitext is displayed (ostensibly as a result of the  tags). This basically removes the content displays from the relevant articles and should ideally be resolved quickly. I've also set up a task at  for this issue. Thanks.  RAVEN PVFF  &#124; talk ~ 01:24, 3 September 2018 (UTC)
 * Six months later, this issue keeps coming up ... &#123;&#123;3x&#124;p&#125;&#125;ery (talk) 03:16, 22 February 2019 (UTC)
 * There is currently a discussion at Help desk regarding a possible issue with this template (also known as Row counter). FYI - wolf  08:55, 22 February 2019 (UTC)

Overhead
I'm investigating List of living cardinals which is showing "Lua error: not enough memory." Module:Row numbers has this code: while (tbl_str:find ('_row_count[^%s|]*')) do   tbl_str = tbl_str:gsub ('_row_count[^%s|]*', get_count, 1); end return frame:preprocess (tbl_str);

Why does it replace keywords one at a time? Using the following code fixes the "not enough memory" error. return frame:preprocess (tbl_str:gsub('_row_count%w*', get_count)); Johnuniq (talk) 06:11, 5 October 2020 (UTC)
 * Probably because before,   was incremented inside the   loop.  I added   to the  , it worked, done.  No other excuse.
 * I've implemented your fix. Thanks.
 * —Trappist the monk (talk) 10:09, 5 October 2020 (UTC)
 * —Trappist the monk (talk) 10:09, 5 October 2020 (UTC)

Thanks for diff which replaced  with. I might forget that again because most of my regex (off-wiki) uses a tool where  follows the C identifier definition and includes underscores, unlike Lua's   which is alpha only. I'm hoping that writing this comment will bring it to my mind next time. Johnuniq (talk) 22:34, 20 October 2020 (UTC)

This template is deprecated still useful
A much better template is Template:Static row numbers

See diff. I was being bold. So I understand why someone would revert it. But try out Template:Static row numbers and see for yourself how easy it is to use. It only requires the addition of static row numbers above the top of the table wikitext. Also the addition of class=static-row-numbers to the table wikitext. Nothing more is required for tables with a single header row.

The template is also much better than rank which is the template I was using previously. Here is the deleted message below that I tried to add to the top of the doc. I just revised it about mobile view.

--Timeshifter (talk) 14:37, 6 May 2021 (UTC)
 * It was I who deleted the deprecation notice. That  is sometimes a pain to use and has its limitations are not issues that I dispute.  If all you need are  row numbers, then by all means use .  If you want the enumerators to be sortable, if you want the enumeration to pause for items that are ranked the same as the previous or succeeding item, if you want the enumeration to begin at an index other than '1', then  won't give you that functionality.
 * From the beginning, has been labeled as a stop-gap that provides functionality not available from MediaWiki.  The real fix for those who need enumeration of any sort is for MediaWiki to support it natively so that  and  aren't needed.
 * I would not have objected to the 'deprecation' if were a drop-in replacement for ; it isn't so I do.
 * —Trappist the monk (talk) 15:10, 6 May 2021 (UTC)
 * I would not have objected to the 'deprecation' if were a drop-in replacement for ; it isn't so I do.
 * —Trappist the monk (talk) 15:10, 6 May 2021 (UTC)


 * OK. Maybe you could add a section to Help:Sorting that explains specifically what Template:Row numbers can do that Template:Static row numbers can not do. Who knows, ... maybe the developer of Static row numbers will add some parameters that do some of those additional things. --Timeshifter (talk) 15:49, 6 May 2021 (UTC)
 * , can you explain why ""...? I don't see that as being "much better". Is there an instruction that can be added (like a simple ""...?) that will also sort the row numbers when other columns are sorted? Also, why is this template "deprecated"? (Based on what? fyi- it works perfectly fine for me on mobile). Also pinging . - wolf  10:58, 18 May 2021 (UTC)
 * The row numbers are static. That way they rank whatever other column is being sorted. It might be possible to add a parameter to allow sorting of row numbers too. But I don't know why one would want that. And I don't know if that sorting would be connected to any other column. ? Maybe the row numbers could simply alternate between descending or ascending order via the sorting icon in the row number header. --Timeshifter (talk) 11:07, 18 May 2021 (UTC)
 * The whole point of Static row numbers was to add row numbers that are not sortable to tables with sortable data (i.e. the static part of the template name). It was for use in tables on things like country populations where total population and population density could be sorted and you wanted to see the rank for the sorted column. It was not designed to replace this template, which I didn't know existed.
 * With the way the rank column is added (using CSS), I don't think an option to sort it is possible. —  Jts1882 &#124; talk 11:12, 18 May 2021 (UTC)

Comment.. I see you reverted my addition of static row numbers. See diff of my work on List of motor yachts by length. It made the table much easier to maintain. You don't have to add _row_count to new entries. In fact you don't have to do anything at all to new entries. --Timeshifter (talk) 11:23, 18 May 2021 (UTC)
 * Different lists have different requirements. That is a list of boats ranked by length. You don't want to sort by builder or owner and see where they rank. If there were columns for length, weight and height then it might be useful to have the static rank to see the rank by different numerical quantities, but that's not the list in question. —  Jts1882 &#124; talk 12:00, 18 May 2021 (UTC)
 * Yes, the list of motor yachts by length is specific to that value. Even if someone wants to say, sort the builders to alphabetize and count them, the yacht ranked #1 by length is still #1. It shouldn't then change to something like #96, because that would be incorrect. The point in having the rank column sort is so all the yachts retain their ranking, regardless of which column is sorted. Furthermore, the template is already there, and has been for over 3 years now. (This article was the reason I asked to create the row_count template in the first place.) It works great, does as asked, and has not been an issue for editors adding new content. Timeshifter, you still haven't answered why this template is "deprecated". -  wolf  18:34, 18 May 2021 (UTC)
 * . I didn't see a need for it now. But you make some good points. So I struck deprecated in the talk section title.
 * . Would it be possible to make a rank column template that could put rank numbers in a blank column? Say for instance that there were columns for length, weight and height. The rank column could be placed to the right of length (and titled "Length rank"). A row number column could be added in the usual place with static row numbers, and titled "Row".
 * The rank column class could be placed in the header of a blank column. A blank column is easy to add with the visual editor. So the header would be:
 * class=rank-column Length rank
 * It would add the rank numbers without the need for _row_count in every cell in the blank column. The rank order numbers would sort the same as row numbers now. Is this possible?
 * This new template would be useful by itself in some tables. For example; in List of motor yachts by length. Since it only has one column that needs ranking. So the rank column could be the leftmost column in that list. --Timeshifter (talk) 21:35, 18 May 2021 (UTC)
 * I don't think what you suggest is possible. CSS styles things according to the position in the HTML table (the position in DOM tree), not according to the contents of the table cells. That type of sorting needs javascript, which means the changes need to be in the Wikimedia software. —  Jts1882 &#124; talk 12:29, 19 May 2021 (UTC)
 * I believe Ttm said pretty much the same when he created this. - wolf 14:55, 19 May 2021 (UTC)
 * Thanks for the reply. Are there any other list articles you are considering working this new template into? I only say this since List of motor yachts by length is pretty stable and has been for years. There is very little turnover, (as in, it's not often a new entry is added and even less so that they are removed), so perhap another list article would benefit from this new template. I would suggest that old favorite; List of countries by wealth per adult (with the separate table of fixed rankings to the left of the main table, but I see that's been changed already). Ah well, just the same, WP has a bah-zillion other lists to choose from. - wolf  22:18, 18 May 2021 (UTC)
 * Thanks for telling me of List of lists of lists. --Timeshifter (talk) 22:26, 18 May 2021 (UTC)

Using template with parser functions
So I'm making a table which uses this template, and I need to use  inside of a time parser function like so:   so it adds a day for each row, but it doesn't work. Is there any way to make this work? TwoBits (talk) 14:50, 12 August 2022 (UTC)
 * Not likely. The value for   is maintained internal to Module:Row numbers so is not available as a value for the   parser function is called – it get the plain string   when it expects a digit.  Further, templates (and parser functions) are executed from inside to outside so the   parser function executes before.
 * —Trappist the monk (talk) 15:17, 12 August 2022 (UTC)
 * Oh well, I was looking for a way to convert the string into a number too but didn't find anything; although it likely wouldn't matter anyways because of the second reason. Guess I'll have to take a more manual approach then. Thanks for your reply and time! (never better said) TwoBits (talk) 15:52, 12 August 2022 (UTC)