Template talk:Row numbers
![]() | This template was considered for deletion on 9 October 2021. The result of the discussion was "no consensus". |
Requested move 28 April 2018
[edit]- 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 {{3x|p}}ery (talk) 14:45, 28 April 2018 (UTC)--Relisting. -- Dane talk 15:54, 5 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. - theWOLFchild 15:52, 28 April 2018 (UTC)
- I think that you are confused.
{{Table row counter}}
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{{row counter}}
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. - theWOLFchild 20:05, 28 April 2018 (UTC)
- Of course, look at how
{{Table row counter}}
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,{{Table row count}}
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)
- Of course, look at how
- 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. - theWOLFchild 20:05, 28 April 2018 (UTC)
- I think that you are confused.
- 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. {{3x|p}}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 Wikipedia: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)
- 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. {{3x|p}}ery (talk) 18:54, 9 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
{{row indexer}}
or{{table indexer}}
.
- 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
[edit]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 <nowiki>
tags). This basically removes the content displays from the relevant articles and should ideally be resolved quickly. I've also set up a Phabricator task at T203293 for this issue. Thanks. RAVENPVFF | talk ~ 01:24, 3 September 2018 (UTC)
- Six months later, this issue keeps coming up ... {{3x|p}}ery (talk) 03:16, 22 February 2019 (UTC)
- There is currently a discussion at Wikipedia:Help desk#Making Wikitable Sortable elements visible to Android/mobile platforms regarding a possible issue with this template (also known as Row counter). FYI - wolf 08:55, 22 February 2019 (UTC)
Overhead
[edit]@Trappist the monk: I'm investigating List of living cardinals#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
get_count()
,count
was incremented inside thewhile
loop. I addedget_count()
to thegsub()
, it worked, done. No other excuse. - I've implemented your fix. Thanks.
- —Trappist the monk (talk) 10:09, 5 October 2020 (UTC)
@Quantocius Quantotius: Thanks for diff which replaced %w
with [_%w]
. I might forget that again because most of my regex (off-wiki) uses a tool where \w
follows the C identifier definition and includes underscores, unlike Lua's %w
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
[edit]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.
This template is deprecated. A much better template is {{Static row numbers}}. It is much easier to use. The row number column is integrated into the table, and allows editing of the table via the Visual Editor. Zooming the font size has no effect on row alignment. Browser window width has no effect on row alignment. Rows can have multiple lines without effecting row alignment. It also works in mobile view. |
--Timeshifter (talk) 14:37, 6 May 2021 (UTC)
- It was I who deleted the deprecation notice. That
{{row numbers}}
is sometimes a pain to use and has its limitations are not issues that I dispute. If all you need are static row numbers, then by all means use{{static row numbers}}
. 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{{static row numbers}}
won't give you that functionality. - From the beginning,
{{row numbers}}
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{{static row numbers}}
and{{row numbers}}
aren't needed. - I would not have objected to the 'deprecation' if
{{static row numbers}}
were a drop-in replacement for{{row numbers}}
; 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)
- @Timeshifter and Jts1882:, can you explain why "The row numbers will not be sorted when columns of data are sorted"...? I don't see that as being "
much better
". Is there an instruction that can be added (like a simple "sort≈y"...?) 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 Trappist the monk. - 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. Jts1882? 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 | talk 11:12, 18 May 2021 (UTC)
- @Timeshifter and Jts1882:, can you explain why "The row numbers will not be sorted when columns of data are sorted"...? I don't see that as being "
- 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)
Comment. Thewolfchild. 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 | 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 Trappist the monk 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)
- Thewolfchild. I didn't see a need for it now. But you make some good points. So I struck
deprecatedin the talk section title. - Jts1882. 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 | 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)
- 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 | talk 12:29, 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)
- Thewolfchild. I didn't see a need for it now. But you make some good points. So I struck
- 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 Trappist the monk 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)
Using template with parser functions
[edit]So I'm making a table which uses this template, and I need to use _row_count
inside of a time parser function like so: {{#time:d/m/Y|21 December 2016 + _row_count days}}
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
_row_count
is maintained internal to Module:Row numbers so is not available as a value for the#time
parser function is called – it get the plain string_row_count
when it expects a digit. Further, templates (and parser functions) are executed from inside to outside so the#time
parser function executes before{{row numbers}}
. - —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)