Template talk:Collapsed infobox section begin

WikiProject iconInfoboxes
WikiProject iconThis template is within the scope of WikiProject Infoboxes, a collaborative effort to improve the coverage of Infoboxes on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.

Warning conditonals edit

Am I correct in assuming that when this script is copied into a parameter- that later is used as a test- than it will blow the code



|other_parameter_1= blah
|yes=yes
{{Collapsed infobox section begin}}
|other_parameter_2= blah {{Collapsed infobox section begin}}
{{#ifeq: yes | yes | Hooray...! | Darn...! }}
|other_parameter_3= blah

If so shouldn't it be marked in the documentation -- Clem Rutter (talk) 16:29, 17 March 2013 (UTC)Reply

it should only be used in fields that directly generate visible information, so putting it in fields that set the colouring, image size, English variation, ... will not work properly. feel free to add to the documentation. Frietjes (talk) 17:04, 17 March 2013 (UTC)Reply

Uncollapsed option edit

As it is at present, the default display is collapsed. Would it be possible to add an optional uncollapsed parameter, which will allow infobox sections to be uncollapsed by default, with a [hide] button in the section heading? - André Kritzinger (talk) 18:19, 9 January 2016 (UTC)Reply

André Kritzinger, sure, see the doc. Frietjes (talk) 16:38, 11 January 2016 (UTC)Reply
Thanks, Frietjes. I tried my luck with Template:Infobox locomotive, and I think I got the hang of it, sort of - see User:Andre Kritzinger/Sandbox. One more thing I'd still need to be able to do, though, is to add (retain) the background colour of the sub-titles (background-color: #eeb47f). People tend to get seriously upset when the appearance of an infobox suddenly changes drastically.... - André Kritzinger (talk) 22:46, 11 January 2016 (UTC)Reply
André Kritzinger, for that application, there is a much better method. I have adjusted your sandbox to show you. Frietjes (talk) 14:56, 12 January 2016 (UTC)Reply
Wow, Frietjes, if you're ever in Cape Town, remember I owe you one! That's exactly what I wanted! - André Kritzinger (talk) 18:00, 12 January 2016 (UTC)Reply

mw-collapsible edit

@TheDJ: Maybe the old collapsible class should be retained for this template, since the header colour can be changed and this can cause readability problems since the show/hide button is always blue (as opposed to being the colour of the surrounding text). Jc86035 (talk) Use {{re|Jc86035}}
to reply to me
13:33, 29 May 2017 (UTC)Reply

Hmm. something to consider indeed. Issue phab:T63018 is still a problem I guess. Or maybe we should just finally get that problem fixed. —TheDJ (talkcontribs) 14:56, 29 May 2017 (UTC)Reply
@Jc86035: fixedTheDJ (talkcontribs) 16:32, 29 May 2017 (UTC)Reply
Example: Template:Collapsed_infobox_section_begin/testcases. —TheDJ (talkcontribs) 16:35, 29 May 2017 (UTC)Reply
@TheDJ: Thanks! I didn't know that was possible. Jc86035 (talk) Use {{re|Jc86035}}
to reply to me
17:21, 29 May 2017 (UTC)Reply
Well only relatively recently. Took me some time to figure out an appropriate strategy to apply this, and there might be edge cases where it fails, but one problem at a time. —TheDJ (talkcontribs) 18:54, 29 May 2017 (UTC)Reply
  • @Jc86035: Hey there, would it be possible to reduce the size of the collapse button to 90% rather than 95%, per Template:Hidden begin? Thanks.--Nevéselbert 17:17, 7 June 2017 (UTC)Reply
    • @Neve-selbert: Why would this be needed? Neither template has any CSS controlling the size of the collapse button relative to the header text. Jc86035 (talk) Use {{re|Jc86035}}
      to reply to me
      05:03, 8 June 2017 (UTC)Reply
      • @Jc86035: It's preferable since the 95% size looks utterly unaesthetic, and is inconsistent with other templates which use 90%.--Nevéselbert 19:15, 8 June 2017 (UTC)Reply
        • @Neve-selbert: I'm sorry, but I have no idea what you're referring to. There is no CSS for 90% size or 95% size in either template. The button is the same size as the header text, which is the same size as every other infobox header. Or am I misunderstanding you? (I've updated the template to prevent the header from being too narrow compared to normal headers, if that's what you were referring to.) Jc86035 (talk) Use {{re|Jc86035}}
          to reply to me
          15:52, 9 June 2017 (UTC)Reply
          • @Jc86035: What I was trying to say is that the size of the button here is larger than the size at Template:Hidden begin, which is rather strange.--Nevéselbert 15:55, 9 June 2017 (UTC)Reply
            • @Neve-selbert: Oh, sorry, the button size for {{Hidden begin}} is slightly different, because it uses a different type of collapsing box (there are three of them). I didn't think it was very noticeable, though. Jc86035 (talk) Use {{re|Jc86035}}
              to reply to me
              16:00, 9 June 2017 (UTC)Reply
              • @Jc86035: It looks quite fugly IMO using the skin I'm using at the moment in editing. I would much rather you change it back.--Nevéselbert 16:03, 9 June 2017 (UTC)Reply
                • @Neve-selbert: Does Monobook (or the skin you're using) have different CSS rules for infobox border padding? Jc86035 (talk) Use {{re|Jc86035}}
                  to reply to me
                  16:05, 9 June 2017 (UTC)Reply

Sigh... how are we EVER going to make progress this way. This is the very definition of bikeshedding honestly.. I'm sure I can find 1 other user who thinks the button is too small.. Then what ? Sit still in grid lock till eternity ? —TheDJ (talkcontribs) 17:19, 9 June 2017 (UTC)Reply

@TheDJ and Neve-selbert: I've updated {{Hidden begin/sandbox}} to use mw-collapsible, and mw-collapsible-content (which I didn't know existed); although there are still issues since I just changed the CSS classes and nothing else. For one thing there's no documentation on how to align the button to the left, so that doesn't work in the testcases. Jc86035 (talk) Use {{re|Jc86035}}
to reply to me
15:15, 10 June 2017 (UTC)Reply
I've improved {{Hidden begin/sandbox}} a bit and adapted the site wide CSS for mw-collapsible toggles a bit, so that everything is a tad more similar. —TheDJ (talkcontribs) 15:06, 12 June 2017 (UTC)Reply
@TheDJ: I think the new class name could be changed to just mw-collapsible-left or even mw-collapsible-swap (to avoid problems with RTL wikis), but other than that it's a nice improvement. Thanks.
Would it be possible to port this (and the font colour change) back into MediaWiki? Jc86035 (talk) Use {{re|Jc86035}}
to reply to me
12:39, 13 June 2017 (UTC)Reply

Is this still maintained at all? edit

I tried to use this template, for an article with multiple infoboxes that would benefit from minimizig, but I ended up with most of the infoboxes still being there. The intent was to have just the name there, but even if the photo was removed, the map would stay there, taking up just as much space.

It also seems to force a css clear that wildly throws off any image in the meantime, even if it's on the other side. SilverbackNet talk 14:05, 15 February 2019 (UTC)Reply

SilverbackNet, if you want help, you should provide an example. Frietjes (talk) 16:18, 15 February 2019 (UTC)Reply

LintHint errors edit

This template throws HTML errors when tested using WP:LintHint I can't edit template-protected pages, nor would you want me to. Could someone please fix these errors? --Guy Macon (talk) 05:46, 25 November 2020 (UTC)Reply

Uses of this template do so or this specific template page does so? --Izno (talk) 18:10, 25 November 2020 (UTC)Reply
Izno, I think uses? Guy and I are coming from Talk:COVID-19_pandemic/Archive 41#Errors_in_Infobox, where he removed the collapsing to get rid of the error, but we'd like to restore the behavior of having the collapsed sections. {{u|Sdkb}}talk 18:14, 25 November 2020 (UTC)Reply
Both, actually. You can see errors at COVID-19 pandemic by looking at the last version before I removed the collapse, and there is an extensive discussion about the technical details of the errors on the article talk page. That being said, LintHint also show errors on this page. I am with Sdkb in thinkling that if the editors of the Covid page want collapsing they should get collapsing, but without it generating HTML errors. --Guy Macon (talk) 18:28, 25 November 2020 (UTC)Reply
It's not fundamentally a problem with {{Collapsed infobox section begin}}, which works by terminating the current table cell and row and starting a new row, with a double-width cell containing a nested table, which itself is collapsible. This works fine with most infobox rows, where it is used in a cell where the innermost unclosed element is the <td>...</td> itself. The problem at COVID-19 pandemic, which uses {{infobox pandemic}}, is that it uses the legend as an image caption, and the underlying Module:Infobox wraps the caption (i.e. the contents of the legend parameter) in a <div style="text-align:left;">...</div>. Now, if you put a {{Collapsed infobox section begin}} into a legend parameter, you're using a </td> when the innermost unclosed tag is a <div>, then the infobox code supplies a </div> when the innermost unclosed tag is a <table>. Similarly, if you put a {{Collapsed infobox section end}} into a legend parameter, you're using a </td></tr></table> when the innermost unclosed tag is a <div>. These unbalanced tags are what lint errors are all about. --Redrose64 🌹 (talk) 23:42, 25 November 2020 (UTC)Reply
Redrose64, hmm, okay. That's largely over my head. What would you suggest we do about it to get the collapsing behavior we want without creating a lint error? {{u|Sdkb}}talk 07:03, 28 November 2020 (UTC)Reply
Put briefly: HTML elements may be nested (to any depth) but must be closed in reverse order so that they don't overlap. Putting {{Collapsed infobox section begin}} or {{Collapsed infobox section end}} inside the |legend= parameter of {{infobox pandemic}} causes misnesting - closing tags are occurring in the wrong order, or are appearing when not relevant. I'm sorry, but if you don't understand HTML fundamentals like this, please stay away from lint errors. Fixing them requires an understanding of HTML. --Redrose64 🌹 (talk) 21:42, 28 November 2020 (UTC)Reply
Redrose64, I'm only here since I care about the collapsing of the infobox maps at COVID-19 pandemic, not since I have any helpful technical expertise. I wish I could just fix it myself, but I'm not at that point. I hope that you or others who know more what they're doing will be able to fix the template so that it works properly (or make whatever other changes might be needed to allow us to get the behavior we want). {{u|Sdkb}}talk 22:08, 28 November 2020 (UTC)Reply
I added an optional |div=y to the begin and end templates to inject extra div tags when used inside of captions. Thanks! Plastikspork ―Œ(talk) 12:51, 10 December 2020 (UTC)Reply
That fixed the COVID-19 pandemic page. Thanks! Should I be concerned that LintHint still shows a "Missing end tag: div" and "Stripped tags: div" error when run on this template? --Guy Macon (talk) 15:17, 10 December 2020 (UTC)Reply
Guy Macon, did this change fix it? Plastikspork ―Œ(talk) 15:34, 10 December 2020 (UTC)Reply
Yes. No errors now. Template:Collapsed infobox section end also has no errors. Good job! --Guy Macon (talk) 16:11, 10 December 2020 (UTC)Reply

Errors are widespread. I came here from Draft:Nafis Amin, where this template is causing stripped tags for <td> and <tr>; I went to Special:WhatLinksHere/Template:Collapsed_infobox_section_begin and started checking the first five, and of those, Albanians and Clement Attlee both have stripped tags attributable to this template.

Separately, this template presents some issues. It it is premised on the notion that infobox markup has sections, but in reality, infobox markup, like all template markup, allows parameters in any order. The following two markups for Albert Einstein render the same:

{{Infobox scientist
| name              = Albert Einstein
| birth_date        = {{Birth date|df=yes|1879|3|14}}
| known_for         = [[General relativity]]
| fields            = [[Physics]], [[philosophy]]
}}
Albert Einstein
Born(1879-03-14)14 March 1879
Known forGeneral relativity
Scientific career
FieldsPhysics, philosophy
{{Infobox scientist
| fields            = [[Physics]], [[philosophy]]
| known_for         = [[General relativity]]
| birth_date        = {{Birth date|df=yes|1879|3|14}}
| name              = Albert Einstein
}}
Albert Einstein
Born(1879-03-14)14 March 1879
Known forGeneral relativity
Scientific career
FieldsPhysics, philosophy

But now if we throw in "collapsed section" what is that supposed to mean if the parameters listed between beginning and end are not rendered in a contiguous group in the infobox?

{{Infobox scientist
| name              = Albert Einstein
{{Collapsed infobox section begin}}
| birth_date        = {{Birth date|df=yes|1879|3|14}}
| fields            = [[Physics]], [[philosophy]]
{{Collapsed infobox section end}}
| known_for         = [[General relativity]]
}}
Albert Einstein
Further information
Born(1879-03-14)14 March 1879
Known forGeneral relativity
Scientific career
FieldsPhysics, philosophy

This very example has three lint errors: a missing end tag for <div> and stripped tags for </td> and </div>. (At some point in the future I reserve the right to comment out the rendered example to make these lint errors go away.)

I object to markup that breaks the model that template parameters can be listed in any order. I won't campaign for deleting this template, but I am campaigning here for the documentation to be improved to explain how {{Collapsed infobox section begin}}...{{Collapsed infobox section end}} must wrap parameters that render as a contiguous block, and how in general to avoid lint errors.

Also, the documented example includes markup commenting out the newline just before {{collapsed infobox section end}}. But that commenting-out markup doesn't seem to make any difference. If it serves no purpose, it should be removed. If it serves some purpose, it should be explained. —Anomalocaris (talk) 23:37, 3 October 2021 (UTC)Reply

Template-protected edit request on 8 February 2023 edit

I noticed a display error of this template in the case that the hidden content has more than two columns like medal tables. Is it possible to expand the "colspan"-attribute to 3 columns (or more)?

On the right is a shortened example where this template does not correctly work. In collapsed mode, the header (here named "Medal list") looks fine, but if you click on "show", it jumps to the left and doesn't span the last column. Henni147 (talk) 15:47, 8 February 2023 (UTC)Reply

I've added a |columns= parameter which might do the trick. Would you mind testing {{Collapsed infobox section begin/sandbox}} to check if it works or not? — Martin (MSGJ · talk) 15:41, 9 February 2023 (UTC)Reply
@MSGJ: Thank you very much for your reply! Is it enough to copy my testcase to the sandbox page (above the documentation template for example), add |columns=3, and check if the testcase is correctly displayed in the preview? I am not familiar with template sandboxes, so I want to make sure that I do it right. Henni147 (talk) 15:56, 9 February 2023 (UTC)Reply
Please see Template:Collapsed infobox section begin/testcases. It's not working yet because the "Medal list" has disappeared — Martin (MSGJ · talk) 16:01, 9 February 2023 (UTC)Reply
@MSGJ: Yes, the example in the sandbox section works correctly. Thank you very much! Henni147 (talk) 16:06, 9 February 2023 (UTC)Reply
Okay that's deployed. If you don't mind, could you update Template:Collapsed infobox section begin/doc with the instructions for the new parameter? I feel there should be an easier way to do this, but it seems to work for now! — Martin (MSGJ · talk) 16:28, 9 February 2023 (UTC)Reply
Yes, I can update the doc page. Thank you very much! Henni147 (talk) 16:30, 9 February 2023 (UTC)Reply

lint errors: th edit

Flinders Street
Passengers
2008–2015 numbers
2008–200924.641 million
2009–201024.670 million   0.12%
2010–201125.187 million   2.09%
2011–201226.187 million   3.97%
2012–2013Not measured
2013–201427.960 million   6.77%
2014-2015Not measured
2015–201628.087 million   0.45%
2016–201727.859 million   0.81%
2017–201828.161 million   1.08%
2018–201928.320 million   0.56%

I'm recently editing railway station articles with many years of passenger number data, and decided to halve them. However, a user pointed out that my edit causes lint errors and I fixed it by adding td=yes and removing div=yes, but th error remains. Can someone fix this error? Below is an extract from the page. Thanks!

{{Infobox station
| name               = Flinders Street
| style              = Melbourne
| mpassengers        = {{collapsed infobox section begin|2008–2015 numbers|td=yes}}
{{Rail pass box|passengers = 24.641 million|pass_year = 2008–2009}}
{{Rail pass box|passengers = 24.670 million|pass_year = 2009–2010|pass_percent = 0.12}}
{{Rail pass box|passengers = 25.187 million|pass_year = 2010–2011|pass_percent = 2.09}}
{{Rail pass box|passengers = 26.187 million|pass_year = 2011–2012|pass_percent = 3.97}}
{{Rail pass box|passengers = Not measured|pass_year = 2012–2013}}
{{Rail pass box|passengers = 27.960 million|pass_year = 2013–2014|pass_percent = 6.77}}
{{Rail pass box|passengers = Not measured|pass_year = 2014-2015}}
{{collapsed infobox section end}}
{{Rail pass box|passengers = 28.087 million|pass_year = 2015–2016|pass_percent = 0.45}}
{{Rail pass box|passengers = 27.859 million|pass_year = 2016–2017|pass_percent = -0.81}}
{{Rail pass box|passengers = 28.161 million|pass_year = 2017–2018|pass_percent = 1.08}}
{{Rail pass box|passengers = 28.320 million|pass_year = 2018–2019|pass_percent = 0.56}}
}}

Purin128AL (talk) 13:34, 12 June 2023 (UTC)Reply

If you insist on hiding content contrary to MOS:HIDE, I think that this usage may require an adjustment to {{Infobox station}}, where |mpassengers= lives in |header62= instead of in a data value. An adjustment to that template may yield good results, though they would need to be tested thoroughly, since the template is so widespread. – Jonesey95 (talk) 14:33, 12 June 2023 (UTC)Reply
If you feel the need to hide the content, why not just remove it from the infobox and let it live in the body of the article? The infobox is to summarize key information, not to have everything in it. If you hide information, it's probably a sign it doesn't belong there. Gonnym (talk) 18:09, 12 June 2023 (UTC)Reply
I will revert the edits then to prevent errors for now, as |mpassengers= uses the template {{Rail pass box}} which would require lots of testing and edit to these two templates.
What information should be kept will be discussed in the new Wikipedia:WikiProject Council/Proposals/Australian Transport then remove excess information as appropriate. Purin128AL (talk) 06:05, 13 June 2023 (UTC)Reply

Strange possible fix for Linter stripped th tag associated with this template edit

This template can be a pain when it comes to causing Linter errors. I just stumbled across this possible fix for a stripped </th> tag: I placed the {{Collapsed infobox section end}} at the end of the embedded child template, before the closing braces, and now there are no more Linter errors. The display remained fine. I haven't taken the time to parse out why this appears to work, or if it is a Linter parsing bug (either a false positive or a false negative), but I just thought I would leave this here for future reference. Comments are welcome. – Jonesey95 (talk) 19:56, 8 February 2024 (UTC)Reply