Template talk:Section sizes

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

Bot proposal[edit]

There is a bot proposal to add this template to talk pages. If this is something you would like to have happen, community support for the bot is required. See Wikipedia:Village_pump_(proposals)#Bot_to_add_{{Section_sizes}}_to_talk_pages to give support (or not) for the bot. -- GreenC 15:52, 4 January 2019 (UTC)[reply]

Requested move 21 April 2019[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 after discussing it on the closer's talk page. No further edits should be made to this section.

The result of the move request was: Moved. (closed by non-admin page mover) SITH (talk) 23:24, 27 April 2019 (UTC)[reply]



– Module and template should have the same name. * Pppery * has returned 00:49, 21 April 2019 (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.

Proposal for optional cumulative size column[edit]

First of all, this module is great, thanks so much for it. I'd like to propose an extension of functionality that would provide an optional third column, with cumulative roll-up values. I can imagine a simple, and a more-complete version of this, let me start with the simple one. In the third column, for each H2 section, provide the sum of all the values in subsections below it (plus any text unique to it, before the first H3 subsection). This will be very handy for long articles with lots of subsections. The resulting column three will have values in cells that correspond to H2 sections, and the remaining cells will be blank. (Ideally, this value should be in the row where the H2 header is, but if it's easier to add a new row, "Section SectionName totals" after the last section and stick it there, that would be acceptable. In that case, gray it out, or background the row with light gray or something, to set it apart.) In the more complete version, provide the totals for lower values as well, so that you'd have values in the H3 subsection cells corresponding to the sum of all subsections below it, and so on.

All of this should be optional, defaulting to no column three, so it's backward compatible. Here's how I imagine it might look (as called from the template):

This would generate a third column, and provide cumulative figures for content under the H2 sections, and the H3 sections. (Articles in principle shouldn't have H1 sections, but I've seen them on some WikiProject pages, and a robust program should test for that case and at least not bomb; either rejecting the value, or processing it anyway and providing the correct figures.)

Here's an example of a real-world article, where these values would be really helpful: Military history of France during World War II. I'm trying to figure out about how to split and merge that article, and the cume figures would help me out a lot. (It would also make a great test page for the sandbox version. )

Thanks, (please Reply to icon mention me on reply; thanks!) Mathglot (talk) 03:30, 16 July 2020 (UTC)[reply]

@Mathglot: Great idea! This would be very useful. --Ita140188 (talk) 04:54, 6 October 2020 (UTC)[reply]
I agree that accumulative values for subsections would be very useful. · · · Peter Southwood (talk): 17:34, 12 November 2020 (UTC)[reply]
I have modified the code and included a cumulative size column. You can check an example below. The modified code is at Module:Sandbox/Ita140188/Section sizes. Let me know what you think. --Ita140188 (talk) 11:48, 11 December 2020 (UTC)[reply]
Pinging interested users: Mathglot Pbsouthwood. --Ita140188 (talk) 11:52, 11 December 2020 (UTC)[reply]
I modified the example with the page suggested above, and collapsible for readability --Ita140188 (talk) 13:57, 11 December 2020 (UTC)[reply]
  • Seems to do what it says on the box. Should work for my needs. Nice. (Have not checked every detail, but what I looked at looks fine) · · · Peter Southwood (talk): 12:47, 11 December 2020 (UTC)[reply]
  • @Ita140188 and Pbsouthwood:, That looks good! Can we lighten (or blank) leaf-nodes in the cume column, in order to make the actual cume figures stand out more? SOmething like this:
Section sizes in Military history of France during World War II (modified)
Section size for Military history of France during World War II (185 sections)
Section name Byte count Cume
_LEAD_ 5,047 5,047
Military forces 9,901 9,901
Free French Forces (1940–1945) 895 13,694
De Gaulle's appeals on the BBC (June 1940) 1,326 1,326
French SAS (1942–1945) 1,017 1,017
Composition (1940–1945) 880 880
French Expeditionary Corps (1943–1944) 540 2,471
Free French Forces and Army of Africa (August 1, 1943) 1,931 1,931
Far East French Expeditionary Forces (1943–1945) 1,542 2,161
Gaurs and CLI commandos (1943–1945) 619 619
Allied munitions (1942–1945) 58 2,816
British support 749 749
US support 2,009 2,009
Units and commands on 8 May 1945 2,128 2,128
Vichy France (1940-1944) 30 11,971
Armistice Army (1940-1944) 1,079 1,079
French State Navy (1940-1944) 113 113
French State Air Force (1940-1944) 137 137
Legion of French Volunteers 35 1,983
French Legion of Fighters 532 532
Legion of French Volunteers against Bolshevism 1,146 1,146
Tricolore Legion (1941–1942) 270 270
French Milice (1943–44) 1,567 1,567
Vichy French Paramilitary Forces (1940–1944) 894 4,792
French Youth Workings (1940–1944) 2,438 2,438
Reserve Mobile Group (1941–1944) 550 550
French Gestapo (1941–1944) 910 910
French SS (1942–1945) 374 1,302
8th Sturmbrigade SS Frankreich (1943–44) 299 299
33rd Waffen Grenadier Division of the SS Charlemagne (1943–1945) 629 629
The African Phalange (1942–43) 617 617
North-African Legion (1944) 351 351
French Resistance (1940–1945) 252 1,421
Resistance groups (1940–1945) 1,169 1,169
French colonial empire (1940–1945) 156 8,077
Struggle for the colonies 2,147 2,147
Army of Africa (1942–1943) 1,802 1,802
Operation Torch aftermath 422 422
Axis retaliations (1942–1943) 545 545
Free French colonies 277 277
Vichy French colonies 462 462
Allied angary (1940) 442 1,842
Operation Catapult and Lend-Lease 787 787
British capture 613 613
Axis requisition (1940–1945) 424 424
Theatres of World War II 30 139,790
European 58 77,304
Phoney War (1939) 1,299 1,299
Battle of Belgium (10–28 May 1940) 617 617
Battle of the Netherlands (10–14 May 1940) 228 228
Battle of France (10 May – 25 June 1940) 78 30,486
Prelude 4,364 4,364
Campaign in the Low Countries and northern France 3,350 3,350
German breakthrough 5,929 5,929
Allied reaction 4,470 4,470
Channel attacks, battle of Dunkirk, and the Weygand Plan (17–28 May) 6,481 6,481
Allied evacuations (26 May – 25 June) 1,405 1,405
British retreat, French defeat (5–10 June 1940) 1,496 1,496
Italy's declaration of war, French-Italian air battles, UK ends French support (10–11 June 1940) 2,038 2,038
French-German negotiations, Pétain's appeal (16–17 June) 875 875
Italian invasion of France (20–22 June) 89 89
French–German and French–Italian armistices (22 June 1940) 816 2,280
Nazi occupation, Vichy France, and Armistice Army 689 689
Formation of Free France and the French Resistance 775 775
Free French airmen in RAF (June 1940–1945) 463 3,503
Free French pilots in the battle of Britain (10 July – 31 October 1940) 2,326 2,326
All-Free French RAF Squadrons (1941–1945) 648 648
Battle of Dieppe (19 August 1942) 66 66
French on the Eastern front (1941–1945) 51 6,557
Legion of French Volunteers Against Bolshevism (1941–1943) 2,260 2,260
Vichy French Sturmbataillon Charlemagne last defenders of Berlin (April–May 1945) 499 499
Free French Normandie-Niemen (1942–1945) 3,747 3,747
Maquis du Limousin (June 1942 – August 1944) 84 84
Italian campaign (1943–1944) 213 4,342
French Expeditionary Corps 566 566
Bernhardt Line (1 December 1943 – 15 January 1944) 528 528
Battle of Monte Cassino (17 January – 18 May 1944) 517 517
Operation Diadem (May 1944) 1,858 1,858
Operation Brassard (17–18 June 1944) 660 660
France maquis warfare (January–July 1944) 53 892
Battle of Vercors (January–July) 312 312
Battle of Glières (30 January – 26 March) 85 85
Battle of Mont Mouchet (20 May – 22 June) 87 87
Battle of Saint-Marcel (18 June) 76 76
Battle of Mont Gargan (18–24 July) 279 279
Campaign of France (1944–1945) 574 23,332
French SAS Brittany airborne landings (5–18 June 1944) 70 1,859
Operation Samwest (5–9 June) 1,552 1,552
Operation Dingson (5–18 June) 172 172
Operation Cooney (7 June) 65 65
Free French contribution to the Normandy naval landings (June 1944) 81 5,309
French contribution on D-Day 644 644
The first to touch the ground of France 1,599 1,599
Free French naval operations (3–16 June) 2,112 2,112
All-Free French air force operations 873 873
Leclerc's 2nd Armoured Division (August 1944 – January 1945) 422 3,502
Battle for Normandy (July 1944) 891 891
Liberation of Paris (24–25 August 1944) 1,130 1,130
Lorraine Campaign, Liberation of Strasbourg (1944 – January 1945) 1,059 1,059
Liberation of southern France (June–August 1944) 62 11,295
Operation Jedburgh (June) 595 595
Battle for Provence (August) 6,212 6,212
Operation Romeo (15 August 1944) 271 271
Liberation of Toulon and Marseilles 4,155 4,155
Liberation of north-eastern France (September 1944 – March 1945) 793 793
Western Allied invasion of Germany (1945) 95 2,117
First French Army in west Germany (March–April 1945) 597 597
Normandie-Niemen air raids over Königsberg (April 1945) 705 705
Free French Division Leclerc at Berchtesgaden (4 May 1945) 403 403
French Army of Africa's 7e RCA at Württemberg (1945) 317 317
Campaign of the Netherlands (1945) 44 941
French SAS Operation Amherst (7–8 April 1945) 897 897
Liberation of Belgium 31 479
Battle of the Bulge (1944–1945) 448 448
English Channel and North Sea 37 4,921
"British treachery" over Free French navy (3 July – 31 August 1940) 4,884 4,884
Atlantic 480 2,095
Battle of the Atlantic 305 305
Last battle of the battleship Bismarck (26–27 May 1941) 295 295
Free French rescue of British Convoy HG-75 (24 October 1941) 883 883
Laconia incident (12 September 1942) 132 132
Mediterranean, Middle East, and African 287 7,114
Naval battle of the Mediterranean (1940–1945) 801 801
Naval battle of Mers El Kébir (3 July 1940) 2,053 2,053
Sabotage operation in Greece (12–13 June 1942) 1,834 1,834
Scuttling of the French fleet in Toulon (27 November 1942) 333 333
Allied invasion of Sicily (9 July – 17 August 1943) 1,064 1,064
Liberation of Corsica (September–October 1943) 742 742
African 15 31,981
West African campaign 33 11,129
Battle of Dakar (23–25 September 1940) 4,612 4,612
Battle of Gabon (8–10 November 1940) 6,484 6,484
East African Campaign 2,233 2,957
Eithrea–Ethiopia campaign (1941) 460 724
Battle of Keren (3 February – 1 April 1941) 264 264
North African campaign and Desert War 883 17,880
North African Free French Air Force (July 1940 – 1945) 1,157 1,157
French Morocco-Algeria campaign (1942) 52 6,712
Coup of Casablanca (7 November) 588 588
Allied invasion of French Morocco 99 99
Naval battle of Casablanca (8–16 November) 96 96
Battle of Port Lyautey (8–12 November) 4,759 4,759
Coup of Algiers 1,050 1,050
Allied invasion of Oran 68 68
French Tunisia campaign (1942–1943) 865 1,427
Run for Tunis (10 November – 25 December 1942) 85 85
Battle of the Kasserine Pass (19–25 February 1943) 106 106
Battle of Medenine (6 March 1943) 75 75
Operation Pugilist (16–27 March 1943) 296 296
Libya campaign 26 7,360
Battle of Kufra (31 January – 1 March 1941) 5,073 5,073
Battle of Gazala (26 May – 21 June 1942) 82 82
Battle of Bir Hakeim (26 May – 11 June 1942) 2,179 2,179
Egypt campaign 26 341
Italian invasion of British Egypt (9–16 September 1940) 108 108
Operation Compass (8 December 1940 – 9 February 1941) 96 96
Second Battle of El Alamein (23 October – 5 November 1942) 111 111
Middle East 49 3,668
French Syria–Lebanon Campaign (1941) 596 2,719
Battle of the Litani River (9 June) 83 83
Battle of Jezzine (13 June) 73 73
Battle of Kissoué (15–17 June) 1,587 1,587
Battle of Damascus (18–21 June) 82 82
Battle of Merdjayoun (19–24 June) 77 77
Battle of Palmyra (1 July) 72 72
Battle of Deir ez-Zor (3 July) 80 80
Battle of Damour (5–9 July) 69 69
Syrian Crisis (May–June 1945) 900 900
Indian Ocean 20 6,467
Allies invade French Madagascar (5 May – 8 November 1942) 4,489 4,489
Battle for La Réunion (22 November 1942) 1,958 1,958
South-East Asian 24 6,210
Vietnam–Laos–Cambodia campaign 46 5,968
Japan invades French Indochina (September 1940) 229 229
Limited Allied support to French Indochina (1943–1945) 1,705 1,705
SOE's French Indochina Section (1943–1945) 3,864 3,864
Japanese coup d'état in French Indochina (9 March – 26 August 1945) 124 124
Thailand campaign 27 218
Thai invasion of French Indochina (October 1940 – 9 May 1941) 100 100
Naval battle of Koh Chang (16–17 January 1941) 91 91
See also 359 359
Notes 24 24
Footnotes 849 849
Further reading 2,467 4,008
Primary sources 1,541 1,541
Total 195,141 195,141
P.S. This is a tiny change, but still my first-ever attempt at Lua coding, so please look it over carefully. Mathglot (talk) 19:52, 11 December 2020 (UTC)[reply]
So, that seems to have worked, but two further tweaks targeting just the style of top level section cume figures (i.e., only the H2's) did not work :-( . Can you look at my code (here, lines 171-173) and tell me why not? Thanks! Mathglot (talk) 20:20, 11 December 2020 (UTC)[reply]
[ec] Mathglot, in principle I like the change, but the grey is almost illegible to me, and there may be more than one level of cumulative size, when there are level 4 or 5 subsections. · · · Peter Southwood (talk): 20:24, 11 December 2020 (UTC)[reply]
@Pbsouthwood: Illegible is kind of the point; I was actually going for blanking it (which would be just as easy). What I'm trying to figure out additionally, and could not so far, is how to bold (or background-color) *just* the cume figures for the top level sections. So, we'd end up with (let's say) boldface for just the H2 sections (there are only ten of them, in that 196-section article), all the leafs (bottom-level sections not containing other sections) would be either blanked in the cume column, or very faded, and all the other cume figures (non-leafs) would be standard-weight typeface. That was my idea, and I think would make it easier to interpret the cume column. My example does the first half of it, but not the second. I could mock up a small example, if my explanation isn't clear. Mathglot (talk) 20:32, 11 December 2020 (UTC)[reply]
I blanked the non-leafs (the values are actually still there, but match the background, so not visible). Mathglot (talk) 20:49, 11 December 2020 (UTC)[reply]
In principle I would be ok with changing font style depending on the depth of section level. However, as Pbsouthwood mentioned, we should have a different style for each level, which seems clumsy. On the other hand, I am definitely against blanking. There is no reason to remove information that may be useful to some. Keeping even the last level allows to compare to other levels when sorting. --Ita140188 (talk) 02:45, 12 December 2020 (UTC)[reply]
Actually, I was going to recommend you remove the sorting, as sorting a hierarchy destroys it and becomes meaningless and makes them incomparable. Unless you want to do "clever sorting" which really only sorts the H2's, and preserves the hierarchy underneath; that would be nice. Why are you against blanking? What do you learn from seeing the identical value in columns 2 and 3? Printing duplicate values merely clutters the third column, and makes it harder to find the actual summary figures. Mathglot (talk) 03:01, 12 December 2020 (UTC)[reply]
I am trying to look at how I would use this table. Knowing how it would be used would suggest how it should be displayed.
  1. To see the most effective ways to split an excessively long article. (Cumulative count very useful, comparative sizes useful, so sorting potentially useful)
  2. To see which sections might be split into smaller sections or subsections within the existing article to reduce walls of text, or combined, to reduce unnecessary fragmentation and toc complexity. (cumulative count not so useful)
  3. Other uses? · · · Peter Southwood (talk): 04:40, 12 December 2020 (UTC)[reply]
Possibly display as a set of columns with only the cumulative values for a specific level in each. Something like :
col 1: the headers, indented as usual to indicate level
col 2: level 2 cumulative coumts
col 3: level 3 cumulative counts, if there are any.
col 4: level 4 cc, etc. recursively
would sorting still be meaningful with this? · · · Peter Southwood (talk): 05:03, 12 December 2020 (UTC)[reply]
another column for local count. could be col 0, col 1.1, or col n+1 · · · Peter Southwood (talk): 05:13, 12 December 2020 (UTC)[reply]

I might use it for judging article splits, but also to judge the overall section organization of the article to see if it's organized properly, and to check not only for article splits, but section splits (or merges), section moves, verifying or adjusting the WP:DUE WEIGHTiness of sections with respect to each other, and with respect to the number of sources available for each of the subtopics, and also to compare it with foreign articles on the same article topic to see how they section their articles, how it compares to ours, and again whether the weight of individual subtopics seem right.

I don't see a need for multiple columns for different levels, but that said, a mockup is worth a thousand words. I've only literally just started with Lua, and though it sounds like a really fun challenge, that might be a stretch for me at this point, or even if I could manage it, it would take too much time away from my never-ending backlog of things on my queue, here, so I'll probably have to demur on that one.

I bet if I sleep on it, I'll come up with more use cases for the section size list. Oh, @Pbsouthwood:, I did want to ask you: don't you find the second one, with the sparse third column much easier to read than the other one? I find the top one with every cell in the column filled in, makes it hard to find which cells are actually subtotals, which sort of defeats the purpose of having it. Mathglot (talk) 08:02, 12 December 2020 (UTC)[reply]

Mathglot@, either of the currently working versions is an improvement, and I can easily live with either, considering it is not a thing I would use every day. I take your point on the extra work of going for perfect when we have good enough, and agree that the sparse final column is easier to read. Better blank/invisible than illegible but visible. The data is anyway there in the previous column, and there is no need to duplicate it. My proposal with multiple columns is just taking that philosophy a step further and making it more obvious which are subtotals of what. Also there is no great rush, and putting the current improvements into service might bring out further useful suggestions. I would leave the sorting option in for now. See if it is useful in practice. Cheers, · · · Peter Southwood (talk): 09:14, 12 December 2020 (UTC)[reply]
I propose a compromise solution: have the cumulative count of main sections in bold, keep a normal font for subsections that have further subsubsections, and leave subsections without any sub-subsection blank. All this while keeping the table sortable (which is very useful for long articles in my opinion). What do you think? I will try to prepare an example soon. --Ita140188 (talk) 09:22, 12 December 2020 (UTC)[reply]
[ec] Ita140188 I think it would cover most cases well and the remainder well enough. · · · Peter Southwood (talk): 09:52, 12 December 2020 (UTC)[reply]
That sounds good to me (except for the sort part; but I can always just not click the header ). The only other thing I'd mention, is whether we need to maintain backwards compatibility in order to retain a 2-column table with no cumulative totals, unless requested by a new param. I've listed the discussion, so we may get some more input on that point.
Oh, Ita140188, can you help me figure out why my boldface change didn't work? I couldn't figure out what was wrong with my edit that failed to bold the cume totals for level 2--can you have a look at rev. 993658293 lines 171-172 of Module:Sandbox/Mathglot/Section sizes, and see if you can see what's wrong with it? Feel free to reinstate that version, if you want to play with it. Thanks, Mathglot (talk) 09:46, 12 December 2020 (UTC)[reply]
Fixed --Ita140188 (talk) 10:30, 12 December 2020 (UTC)[reply]
In what cases might retaining a 2 col table with no cumulative totals be preferable?
How much additional work and complexity would retaining 2 col no cumulative totals require?
Personal opinion: would not matter to me at all. · · · Peter Southwood (talk): 15:28, 12 December 2020 (UTC)[reply]
@Pbsouthwood:, you may be right; I suppose it's just a general philosophy wrt programming, in that you don't "fix" something that isn't broke, and those that are happy with it the old way, won't say anything here, until we change something in the way they're used to seeing in, and will then squawk, "There was nothing wrong with it before!" (Although this isn't respected as much as it used to be.) Who knows, maybe an extra column will screw up on mobile devices with narrower viewports; you never know. I guess it's just my general principles of wanting to add an enhancement, without upsetting existing users. (I think it's possible to test for mobile platform, and we could skip the additional column in that case, if that were advisable.) Mathglot (talk) 21:04, 12 December 2020 (UTC)[reply]
So, I checked it out using WP:Mobile view sidebar, and sure enough, it's not optimal. It's not a disaster, i.e., there aren't horrible folded lines making inscrutable row content; it's just that the third column is mostly clipped. But having it as an optional param when invoking the template (or if not optional, suppressed for mobile) would be an improvement. If added, imho this code should go in the template code, not the module code. Mathglot (talk) 01:42, 13 December 2020 (UTC)[reply]
I updated my version of the module with the new proposal. Let me know what you think. --Ita140188 (talk) 13:02, 13 December 2020 (UTC)[reply]
@Ita140188:, it looks great! One tiny quibble: because the column header 'Cumulative' is longer than the data values in the column, the values end up with lots of leading white space, which doesn't matter on a wide device, but cume values are not visible in some mobile devices (i.e., mine ). I copied your version 993958501‎ and shortened the header (see diff between our two versions). See what you think (check also on a narrow mobile device, if possible). And thanks so much for all your work on this! (I still don't understand some of the Lua errors I got during some of my tweaks; is there a board somewhere, where new Lua editors can get help?) Thanks, Mathglot (talk) 21:36, 13 December 2020 (UTC)[reply]
@Ita140188 and Mathglot:, One further observation: In articles with list defined references, the references section can easily be the largest, sometimes by quite a margin. I am not convinced that using the red colour code for that section is the best use of a limited resource. What do you think? · · · Peter Southwood (talk): 15:42, 15 December 2020 (UTC)[reply]
Considering that list defined references are quite rare (at least in my experience), I think it's not worth it to change the code for this case. Also, by sorting the table it is easy to check which section is the next largest. --Ita140188 (talk) 15:49, 15 December 2020 (UTC)[reply]
I find them fairly common, though I have never done a comparison. Does the count include refs defined in the section or other wikicode? Just rendered text? · · · Peter Southwood (talk): 15:58, 15 December 2020 (UTC)[reply]
It counts the source (any wikicode) size (in bytes). It's equivalent to the text you would see when you open the section in "Edit source". Can you cite an example of an article using list defined refs just to understand how it would look like with the new module? (by the way, this problem would also apply to the current module) --Ita140188 (talk) 16:21, 15 December 2020 (UTC)[reply]

Deciding on consensus[edit]

More comments would be good, especially regarding the question of making the new functionality the default, or making it subject to a parameter but if nothing is forthcoming in several days, shall we just move the latest version to live? Mathglot (talk) 01:14, 14 December 2020 (UTC)[reply]

I support making the new version live. Maybe after testing on some edge cases. For example, in my version there is a maximum depth of sections allowed, and it would not manage higher sections (those with 1 "="), which however I think should not be used in any case. If proved to work well, it only adds functionality and I think most people would find it very useful. For those who don't, it probably does not make much difference. --Ita140188 (talk) 03:22, 14 December 2020 (UTC)[reply]
I just checked (User:Ita140188/sandbox2). Level 1 sections (which should not be used) are ignored. Sections higher than 6 are actually ignored by Wikipedia anyway (the extra "=" become part of the section title), so they are not a problem. --Ita140188 (talk) 03:27, 14 December 2020 (UTC)[reply]
If no-one objects within a week, I suggest go live. If that does not draw fire within a few days it will probably be no problem longer term. It will probably never be noticed by most. I am keen to start using it. Cheers, · · · Peter Southwood (talk): 16:49, 15 December 2020 (UTC)[reply]
I did a WP:BOLD move and updated the module. If there are any problems we can always revert. --Ita140188 (talk) 01:30, 17 December 2020 (UTC)[reply]
@Ita140188 and Pbsouthwood: That seems fine; let's all keep this on our watchlists, just in case. And thanks, all. One last question for Ita: is there a board or project page somewhere for new Lua users to ask questions? This was my first experience with it; I clearly have a long way to go, but other o-o languages make it seem not that strange, so I probably just need to get used to it. Mathglot (talk) 23:20, 18 December 2020 (UTC)[reply]
@Mathglot: I am not sure, I also just started programming in Lua. I have learnt by trial and error by myself. My only previous experience was an update to the chart module that was rejected: Module:Sandbox/Ita140188/chart2. In any case, if you have some problems maybe I can help (at least I can try!). --Ita140188 (talk) 11:24, 20 December 2020 (UTC)[reply]

Prose size[edit]

Hello, just found this great tool. From what I understand (please correct if wrong), it is measuring the total byte size within each section. Would it be possible for it to also assess the prose size too, similarly to what Wikipedia:Prosesize does for the whole page? Best, CMD (talk) 09:27, 25 January 2021 (UTC)[reply]

@Chipmunkdavis: You are correct, the tool measure the total byte size (source code) of each section. I am not sure how easy it would be to incorporate the prose size calculation, it seems that the JS code should be rewritten in Lua. It may be worth it if enough users think it would be useful. --Ita140188 (talk) 10:38, 25 January 2021 (UTC)[reply]
@Ita140188 second vote here! There's discussion here about section sizes Wikipedia_talk:Article_size, and the limits have been changed from kb to words so should prove useful, Tom B (talk) 18:20, 28 November 2023 (UTC)[reply]
Agreeing with the above, a word count tool per section would be incredibly valuable. —Femke 🐦 (talk) 16:14, 24 April 2024 (UTC)[reply]

Red formatting?[edit]

Just came over from Talk:COVID-19 pandemic in Australia after seeing this template; it would have saved me so much time when showing PEIS results! The documentation seems to be lacking; I see that some numbers are formatted in red, which I presume to be past a size of concern. When does the formatting occur? —Tenryuu 🐲 ( 💬 • 📝 ) 14:45, 11 June 2021 (UTC)[reply]

From Module:Section sizes:
This module creates a wikitable that lists each section in a page along with that section's size in bytes. Each section is wikilinked to its target in the page; subsections are indented; largest section's byte-count is highlighted in red.
Trappist the monk (talk) 14:48, 11 June 2021 (UTC)[reply]
Many thanks, Trappist the monk! Would there be any objection to me adding this information to the template's documentation? —Tenryuu 🐲 ( 💬 • 📝 ) 14:52, 11 June 2021 (UTC)[reply]
I cannot image why anyone would object to any improvements to template documentation.
Trappist the monk (talk) 15:29, 11 June 2021 (UTC)[reply]

Section headers with embedded anchors[edit]

There may be a problem parsing section names that have permitted embedded anchors (guessing ~l.95 or l.105). The only example I have for sure is section LGBT#Criticism of the term, which contains the following code:

== <span class="anchor" id="Criticism"></span> Criticism of the term ==

The manifestation of the problem that I see, is in the invocation of {{section sizes}} at Talk:LGBT, where the section header "Criticism of the term" is not wikilinked, and also has some code-cruft in it.

See also MOS:SECTIONSTYLE for additional examples of permissible embedded items inside section headers; not sure if the code presently handles these or not. Mathglot (talk) 03:44, 25 July 2021 (UTC)[reply]

Hitting the same issue at Talk:Rebreather_diving. Not a crisis, just thought I would mention it. · · · Peter Southwood (talk): 16:03, 14 December 2021 (UTC)[reply]
@Mathglot, @Pbsouthwood: Fixed this issue (Special:Diff/1135136755). However, the fix removes anything anywhere between < & >, and there might be use cases where actual content is added inside < & >, so let me know if it is a huge issue that affects the module's usability. I asked for assistance at WP:VPT too, in case anyone can help. CX Zoom[he/him] (let's talk • {CX}) 21:30, 22 January 2023 (UTC)[reply]
The issue with Talk:LGBT is fixed, thanks very much for this update. Mathglot (talk) 22:15, 22 January 2023 (UTC)[reply]

There is a related issue at articles with section headers with embedded anchors via templates {{Anchor}} or {{Vanchor}}. Guessing we need a new sub remove_anchor that does something similar to the existing one for < .. >. Live example at Talk:Glossary of French criminal law. Included here for the record, but definitely *not* a huge issue; occurs rarely, afaict. Mathglot (talk) 23:03, 6 February 2023 (UTC)[reply]

@Mathglot: I couldn't understand what is the happening here. It looks working as intended? CX Zoom[he/him] (let's talk • {CX}) 10:35, 8 February 2023 (UTC)[reply]
Things changed since I wrote that. Sorry for wasting your time, it is indeed working as intended now, because someone went through the glossary after I posted above, and removed twenty section headers, including the ones causing the problems. When I get back to that article, I will replace the section headers again, and I'll ping you at that point. Or if you are able to point the tool at a copy of the article in a sandbox, try it with revision 1137940642‎. Thanks for checking. Mathglot (talk) 18:23, 8 February 2023 (UTC)[reply]

Should work transparently in Draft or Main space[edit]

The template should work, regardless whether it sits in Draft space or in Main space. For the time being, I am using this workaround on the Talk page of Draft articles:

{{section sizes|{{#ifeq:{{NAMESPACE}}|{{ns:Draft talk}}|Draft:|}}Name_of_the_Article}}

which worked fine at Draft talk:List of scandals in Brazil, and now works seamlessly in Main. (And yes, I'll fix it after a while.) Mathglot (talk) 20:25, 2 March 2023 (UTC)[reply]

I agree, no idea why this hadn't been done before. In fact, this should work anywhere, including project pages and discussion boards. So, I changed BASEPAGENAME to SUBJECTPAGENAME. Cheers! CX Zoom[he/him] (let's talk • {CX}) 18:04, 3 March 2023 (UTC)[reply]

Purpose and design questions[edit]

What is the purpose of of adding {{section size}} to random articles? Who made this template, why is it not counting actual prose size and who decides the color coding? Peter Isotalo 07:24, 21 September 2023 (UTC)[reply]

@Peter Isotalo: The purpose is to have an overview of how large the sections are. This can help in reorganizing articles, for example. For the prose size, there was a proposal Template_talk:Section_sizes#Prose_size but since this seems to be quite complex to do, and there was no other evidence of support, it has not been implemented. As for who made the template and who decided the colors, you can check the template history and this talk page. You can add here your suggestions if you have any. --Ita140188 (talk) 07:54, 21 September 2023 (UTC)[reply]
@Ita140188: I think two things are pretty essential:
  • The go-to standard for article size discussions has been prose size for I don't know how long now. All guidelines are written in terms of prose size. I personally think that section size is a far more relevant measurement than total article size, but if it's not expressed as readable prose, this template can be very difficult to interpret properly.
  • Don't apply any color markings. We have a some rough guidelines regarding total article size but nothing about how large sections should be. I'm guessing there's a de facto 2-4 paragraph limit that most of us try to adhere to, but total prose size can still vary quite a lot within that that 2-4 paragraph span. A paragraph is not automatically worse the more words it contains. I could just as well argue that stubby 1-2 sentence paragraphs are just as bad. Also, an L2 heading with just text content directly under it shouldn't be counted the same as an L2 with an extensive structure of L3 or L4 headings.
I am all for recommendations on section size, but only if it's done through appropriate guidelines, like WP:SIZE or the likes. Until there's some sort of consensus about this, I don't think it's appropriate that this template should be added to articles only be involved editors.
Peter Isotalo 13:34, 21 September 2023 (UTC)[reply]
This template is not trying to set any limits or guidelines for sections sizes. Also, the colors are just shades of red depending on the relative size of sections in the article to make the table more legible (not based on some absolute number and not giving any "judgment"). As for prose size, I agree it would be nicer, but somebody needs to put the work to make it happen. I briefly looked into it and thought it would take quite a long time to implement in a robust way. I don't have time now, but if you do please go ahead. Ita140188 (talk) 15:16, 21 September 2023 (UTC)[reply]
Red is not a neutral color for this purpose and is one of the reasons I reverted the addition of the template to talk:galley. You should keep in mind that there's a context of disagreement on article size withing the project. The WP:SIZE limitations are interpreted somewhat differently as is, and the figures themselves are based on 20 year old consensus guesstimates without any kind of basis in research on Wikipedia reader behavior.
Peter Isotalo 15:49, 21 September 2023 (UTC)[reply]
You are free to propose a more "neutral" color. Maybe blue? As for the disagreement on the optimal size and relative debate, again, this template has nothing to do with it as it does not imply any limit or judgement on what the optimal size of sections should be. Ita140188 (talk) 17:25, 21 September 2023 (UTC)[reply]

Error[edit]

Why in Wikipedia:Village pump (proposals), we have this error: Wikipedia:Village pump (proposals) is a redirect, as this page is not a redirect or other means. Just a random Wikipedian(talk) 10:19, 29 September 2023 (UTC)[reply]

Because Wikipedia:Village pump (proposals) § Proposal: extend ACPERM to IP editors overwriting redirects has the plain text #redirect (3×). The module should probably not be looking for that text and should instead rely on the title object property isRedirect.
Trappist the monk (talk) 12:16, 29 September 2023 (UTC)[reply]
How about to do that (#isredirect thing?) Just a random Wikipedian(talk) 13:10, 30 September 2023 (UTC)[reply]

Script error at Talk:Food security[edit]

This template causes an error, Lua error in Module:Section_sizes at line 156: attempt to perform arithmetic on field '?' (a nil value). at Talk:Food security. I added a test case to the test cases page. I have not done any troubleshooting. – Jonesey95 (talk) 20:48, 9 May 2024 (UTC)[reply]