Jump to content

Template talk:Row numbers

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
(Redirected from Module talk:Row numbers)

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)[reply]


Template:Row counterTemplate: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)[reply]

You could just boldly move it. I'm sure of you select a reasonable name, no one will object. - theWOLFchild 00:46, 10 May 2018 (UTC)[reply]
Trappist the monk (talk) 01:12, 10 May 2018 (UTC)[reply]

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)[reply]

Six months later, this issue keeps coming up ... {{3x|p}}ery (talk) 03:16, 22 February 2019 (UTC)[reply]
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)[reply]

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)[reply]

Probably because before get_count(), count was incremented inside the while loop. I added get_count() to the gsub(), it worked, done. No other excuse.
I've implemented your fix. Thanks.
Trappist the monk (talk) 10:09, 5 October 2020 (UTC)[reply]

@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)[reply]

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)[reply]

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)[reply]
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)[reply]
@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)[reply]
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)[reply]
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)[reply]

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)[reply]

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)[reply]
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)[reply]
Thewolfchild. I didn't see a need for it now. But you make some good points. So I struck deprecated in 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)[reply]
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)[reply]
I believe Ttm said pretty much the same when he created this. - wolf 14:55, 19 May 2021 (UTC)[reply]
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)[reply]
Thanks for telling me of List of lists of lists. --Timeshifter (talk) 22:26, 18 May 2021 (UTC)[reply]

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)[reply]

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)[reply]
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)[reply]