Jump to content

Template talk:Flatlist

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

Template-protected edit request on 30 October 2017

[edit]

Hi, could the html markup in this template be fixed? See https://en.wikipedia.org/w/index.php?title=Template:Flatlist/sandbox&oldid=807871376 for a correct fix where the div is closed outside the if section instead of adding an extra closing div in the noinclude section.

Tholme (talk) 15:54, 30 October 2017 (UTC)[reply]

@Tholme: I'm not sure your change is correct. When used without parameters, typically using the redirect {{startflatlist}}, the template is required to leave the div open so that the end of the list can be marked with {{endflatlist}}. -- John of Reading (talk) 17:09, 30 October 2017 (UTC)[reply]
You are right, so don't do the change. Tholme (talk) 17:35, 30 October 2017 (UTC)[reply]

Display issue on mobile version

[edit]

Raised Wikipedia:Village pump (technical)#Template:Flatlist does not display correctly on mobile in case if anyone is not aware. ネイ (talk) 16:45, 24 May 2020 (UTC)[reply]

I added the class hlist-separated, which is present in {{hlist}} and appears to make bullets render in mobile. Report any bugs here. – Jonesey95 (talk) 17:57, 24 May 2020 (UTC)[reply]
@Jonesey95: Nested flatlists do not display closing parentheses on mobile; see for example "People or cargo transported" in the infobox at Atlas V. I get the same issue with {{hlist}}, I'm guessing because they use the same class. @ネイ: I redirected the link in your comment to the archive. Hairy Dude (talk) 14:44, 20 February 2022 (UTC)[reply]
I don't know if second-level asterisks are formally supported in this template. I have added a case to the testcases, showing that there are missing closing parens after "Curiosity" and "Quasar" in mobile view. – Jonesey95 (talk) 18:25, 20 February 2022 (UTC)[reply]
One note: Removing "hlist-separated" from the class declaration removes the bullets and restores the closing parens. See the sandbox version in the mobile testcases link above. – Jonesey95 (talk) 23:16, 20 February 2022 (UTC)[reply]
li:after is different in MediaWiki:Mobile.css than what is in MediaWiki:Common.css. -- WOSlinker (talk) 23:54, 20 February 2022 (UTC)[reply]
I don't know why it's like this or why it's important. Sigh. Yes, that would be the issue. Izno (talk) 00:14, 21 February 2022 (UTC)[reply]
The relevant task is probably phab:T174399. Izno (talk) 00:15, 21 February 2022 (UTC)[reply]
Izno, based on the age of these phab tickets (see also the ill-fated T169315), it looks like we are on our own. Would it help to have a custom styles.css file for this template? – Jonesey95 (talk) 00:23, 21 February 2022 (UTC)[reply]
Yes, but that's after MediaWiki talk:Common.css/to do#Hlist is done. I haven't laid out everything that needs to happen there yet, but getting that 5k listed down to false positives would be a good start. Izno (talk) 00:50, 21 February 2022 (UTC)[reply]
Izno, that 5k list is only 1k if you ignore the Wikipedia:Main Page history subpages (or treat them as a separate set). -- WOSlinker (talk) 15:27, 22 February 2022 (UTC)[reply]
As I said, haven't done a lot of work with the hlist case. If that knocks out 4k, that works for me. Feel free to leave a link in the working section with the refined search. Izno (talk) 18:05, 22 February 2022 (UTC)[reply]
I've fixed this in mobile.css. We'll probably have to refix it when we get around to deploying the TemplateStyles version because when we do I want to review what hlist-separated is actually doing. Izno (talk) 22:43, 6 March 2022 (UTC)[reply]
For the record, this edit shows the current workaround for this goofiness. – Jonesey95 (talk) 02:40, 7 March 2022 (UTC)[reply]

Why the extra closing tag?

[edit]

Is there a purpose for the seemingly stripped </div> after the <noinclude>? —Anomalocaris (talk) 22:59, 22 December 2020 (UTC)[reply]

I think it's because there is no |1= in the template page itself. When you say "seemingly stripped", what do you mean? To me, it appears to match the opening tag just fine, but it is needed only on this page (hence the noinclude tag). Is that closing tag causing an error somewhere? – Jonesey95 (talk) 00:18, 23 December 2020 (UTC)[reply]
I see </div> just before }} and then another one inside </div><noinclude>...</noinclude>, which, to my naive eye, seems to be stripped. I think you were trying to explain this to me above, so maybe you'll have to explain it at a more basic level, since I don't know why I should care about |1=. Anomalocaris (talk) 23:14, 28 December 2020 (UTC)[reply]
The template may be used in two differing ways: (i) like the first example at Template:Flatlist#Examples, where the entire list is passed into {{flatlist}} through its |1= parameter; (ii) like the example at Template:Flatlist#Alternative syntax, where the list is placed between {{startflatlist}} and {{endflatlist}}. In the case of (i), the single use of {{flatlist}} wraps the list in <div class="hlist hlist-separated">...</div>, which is a balanced tag pair; in the case of (ii), the {{startflatlist}} produces an unclosed <div class="hlist hlist-separated"> tag, and this is closed by the {{endflatlist}} which produces the balancing </div> tag (and nothing else). Now Template:Startflatlist is merely a redirect to Template:Flatlist, so the second example may be written
{{flatlist}}
* [[cat]]
* [[dog]]
* [[horse]]
* [[cow]]
* [[sheep]]
* [[pig]]
</div>
and this shows that when {{flatlist}} is used without parameters, some form of explicit closure is required, which is why there is that </div> after the <noinclude>. --Redrose64 🌹 (talk) 10:04, 29 December 2020 (UTC)[reply]
Redrose64: Thank you for explaining it so clearly. —Anomalocaris (talk) 10:45, 1 January 2021 (UTC)[reply]

Protected edit request on 3 June 2025

[edit]

Please replace the live template with the sandbox version. This change does two things:

1. It moves the closing /div tag outside of the #if statement to match the opening div tag. This fixes an unclosed div tag error when the template is used with no input. See the relevant test case.

2. It adds standard template unknown parameter checking. There are currently 300+ pages using this template with unknown parameters, which is preventing desired information from being displayed. I just fixed an article that previously had an incorrect fix applied because this template was not displaying any error messages.

Thanks! – Jonesey95 (talk) 21:25, 3 June 2025 (UTC)[reply]

 Not done: I am fairly certain your change would break the use of flatlist to start a flatlist, as in a pair of {{flatlist}} * A * B * C{{endflatlist}}, no? Izno (talk) 22:01, 3 June 2025 (UTC)[reply]
Ah, you are correct. I don't recall seeing that construction. I have modified the sandbox to implement only the parameter checking. – Jonesey95 (talk) 00:38, 4 June 2025 (UTC)[reply]
 Done * Pppery * it has begun... 01:04, 4 June 2025 (UTC)[reply]
Should the template be usable is two ways like that? Would it not be better to have something like {{startflatlist}} for such cases? Andy Mabbett (Pigsonthewing); Talk to Andy; Andy's edits 13:50, 6 June 2025 (UTC)[reply]
I think so, but that ship might have sailed. I don't know if it's worth the candle. – Jonesey95 (talk) 15:13, 6 June 2025 (UTC)[reply]