Module talk:Random slideshow

Latest comment: 2 years ago by Jonesey95 in topic bogus file option lint errors

Mobile view improvement

edit

I've come up with a better way to display this module on mobile – demo at Portal:Kent/Sandbox (mobile view). It uses TemplateStyles and Template:Switcher-like switching to display one item at a time, with radio selection buttons below to select which image to display.

Sandbox modules/styles used in demo:

It's not perfect. For one thing, it won't work in Template: namespace (for the same reason {{If mobile}} doesn't). But it is a big improvement compared to what currently happens.

I'll deploy this solution in a couple of days from now, unless there are any concerns raised. - Evad37 [talk] 04:37, 2 May 2021 (UTC)Reply

Thanks Evad37, that looks a lot better. My only reservation is that the radio buttons bounce around as the content size changes. If possible, would it be better to put them in a stable position at the top, or would that make them too prominent at the expense of the more important content below? Pinging Moxy, who seems to be our expert on these matters. Certes (talk) 10:08, 2 May 2021 (UTC)Reply
Much better.....agree butons a bit small..... but every image showing in mobile view is over so that's the biggest sloved.--Moxy-  11:40, 2 May 2021 (UTC)Reply
@Certes and Moxy: I've managed to place the radio buttons at the top, and keep them centered so they don't jump around. I've also scaled up their size a little bit - Evad37 [talk] 05:01, 3 May 2021 (UTC)Reply

  Done @Certes and Moxy: - Evad37 [talk] 06:26, 7 May 2021 (UTC)Reply

Something in this change appears to be causing Linter bogus image options errors. If you turn on the LintHint gadget, you can see them. As far as I can tell, the problem appears when |alt= is specified in the File: call on a target page. It appears that the new <span>...</span> tags are not separated from that alt parameter by the necessary pipe. In Climate change, for example, one of the errors shows up as <span class="switcher-label" style="display:none"><span class="randomSlideshow-sr-only">Image 1</span></span>alt=An emaciated polar bear stands atop the remains of a melting ice floe. I'm guessing that this makes the alt tags fail to work properly for blind readers as well. – Jonesey95 (talk) 20:41, 7 May 2021 (UTC)Reply
Template should not be used in main space ever......way to many problems.....as is why it's not used anywhere in main space but that one article that has major accessibility problems..... so much so that it's FA status should be removed due to accessibility as.per Template:Transclude files as random slideshow Moxy-  21:02, 7 May 2021 (UTC)Reply
OK, I have prevented it from working in article space. Is someone available to fix the missing pipe problem, or should I revert the recent changes? – Jonesey95 (talk) 15:43, 10 May 2021 (UTC)Reply
Evad37, this change seems to have strange results in the Portal namespace. Compare "Selected images" in Portal:Amphibians and "Selected pictures" in Portal:Sports. Portal:Amphibians has the radio selection buttons even on desktop. —⁠andrybak (talk) 09:58, 15 May 2021 (UTC)Reply
@Andrybak:   Fixed. The new styles needed to be added to Module:Portal pictures. - Evad37 [talk] 12:22, 23 May 2021 (UTC)Reply

bogus file option lint errors

edit

@Izno, GKFX, Andrybak, Sophivorus, Certes, Ymblanter, and Pppery: Portal:Journalism has 3 Bogus file options lint errors, which I tracked down to one error per article in the following markup:

{{Transclude files as random slideshow
|Newspaper
|Entertainment journalism
|Data-driven journalism
}}

I reset Module:Random slideshow/sandbox to the production version of 14:50, 10 March 2021 by Freitjes, and using {{Transclude files as random slideshow/sandbox}} in the above markup, the bogus file options go away. So the bogus file options are a result of the changes introduced in the edit of 06:25, 7 May 2021‎ by Evad37. Fixing modules is beyond my skill set, but I have localized the problem. —Anomalocaris (talk) 20:27, 13 May 2021 (UTC)Reply

Anomalocaris, should be generally fixed now. Frietjes (talk) 14:28, 14 May 2021 (UTC)Reply

Frietjes: Portal:Cannabis has 1 Bogus file options lint error, which I tracked down to following markup:

{{Transclude files as random slideshow
| Medical cannabis
}}

I reset Module:Random slideshow/sandbox to the production version of 14:50, 10 March 2021 by Freitjes, and using {{Transclude files as random slideshow/sandbox}} in the above markup, the bogus file option goes away ... almost. It's replaced by one of those pesky, dare I say "bogus px" bogus file options. Anyway, the longer bogus file option is attributable to your latest change. —Anomalocaris (talk) 17:20, 14 May 2021 (UTC)Reply

Anomalocaris, have you considered fixing the articles instead? if the parameters image parameters are bogus, then there should be no reason not to fix the articles. for example, this search shows many upright problems (syntax not documented in Wikipedia:Extended image syntax). Frietjes (talk) 19:39, 14 May 2021 (UTC)Reply

Some version of this error is still present on a few Portal pages. I used Special:ExpandTemplates with "Portal:Marine life" in the Context title to expand the following:

{{Transclude files as random slideshow
| Marine habitats
}}

That results in a bogus image option here:

File:Eurythenes plasticus (10.11646-zootaxa.4748.1.9) Figure 3.jpg|<span class="switcher-label" style="display:none"><span class="randomSlideshow-sr-only">Image 2</span></span>thumb|640 µm microplastic found in the deep sea amphipod ''Eurythenes plasticus'' (from '''[[Marine habitats]]''')

An error-free instance looks like this:

File:The White Rocks near Portrush (1) - geograph.org.uk - 785899.jpg|<span class="switcher-label" style="display:none"><span class="randomSlideshow-sr-only">Image 3</span></span>Sandy shores provide shifting homes to many species (from '''[[Marine habitats]]''')

Note the undesirable presence of thumb| in the former example. It looks like the module attempts to strip out "thumb" and similar parameters from gallery entries, but in this case, it appears to have failed. This "thumb" problem appears to be happening in a just a couple of Portal pages, but there are similar errors in a dozen or so Portal pages, so fixing it in the module would be best. There are a few more instances of complex markup in image captions failing to be stripped or parsed correctly (e.g. "Map of counties in Missouri by racial plurality, per the 2020 US Census" from Missouri). I'm hoping a change to the regex in the module will be sufficient. – Jonesey95 (talk) 20:43, 16 September 2022 (UTC)Reply

@Jonesey95: In the case of the Marine habitats, that appearance of thumb appears to be more of a case of GIGO than the module's fault. The image causing issues there is from a <gallery>...</gallery>, and images in galleries do not support the |thumb| option (or at least not as far as I can tell), so the module never expects to have to remove it. I've removed the occurance of it from the article it's on, but correct me if I'm wrong on this call. Aidan9382 (talk) 18:07, 30 September 2022 (UTC)Reply
As for the errors appearing on some of the other portal pages, like Portal:Pennsylvania (the issue lies in File:Pennsylvania Counties by race (2020 census).svg from Pennsylvania) is because of the fact that the description includes tables and templates, which, due to one reason or another (potentially due to the more limited form of gallery compared to files, but im not sure), isn't going to work or display nicely in the slideshow. In terms of fixing that, I'm not exactly sure what to recommend, as what the issue is specifically is hard to pin down. Any ideas? Aidan9382 (talk) 18:58, 30 September 2022 (UTC)Reply
As I suggested in the other discussion, maybe one solution is to render the file on its own, then insert a line break and then render the caption without any processing, outside of the File: invocation. – Jonesey95 (talk) 20:25, 30 September 2022 (UTC)Reply
I have created Template:Transclude files as random slideshow/testcases2 to demonstrate two of these errors. – Jonesey95 (talk) 14:01, 2 October 2022 (UTC)Reply
Came across this issue again while investigating something else, so I decided to take a look. The primary issue lies in how galleries work, and how they don't respect tables that well, and unfortunately I'm not sure if this has a simple solution. I've left my findings on what I've noticed on this page with examples, which should explain it well. As for solutions, the only idea I have is preventing the expansion of templates, but I have yet to test this, and I'm not sure if the expansion is currently intentional for a different reason. Aidan9382 (talk) 10:16, 17 October 2022 (UTC)Reply
@Jonesey95: Good news - after quite a touch up today with how the module works and some more light work yesterday, I've mostly fixed the 2 main causes of the bogus file option linter errors, bringing down the total number of errors from what I think was ~140 to 10 (and a few are human errors, not the module). I'm going to do a minor look into weird upright inclusion behaviour after this post, but as far as I can see the new version is working fine, though if you notice any issues or have suggestions, do tell me. Hope this helps. Aidan9382 (talk) 12:16, 4 November 2022 (UTC)Reply
...iiiiif I didn't run into issues, which apparently seems to be impossible with me :). Turns out Module:Excerpt slideshow was quite unhappy with what I tried and blew up on the spot, so I also now have to go fix that. If the linter errors are back to below 15, I've found a fix before you've seen this. If not, hopefully I will soon after. Aidan9382 (talk) 12:31, 4 November 2022 (UTC)Reply
Thanks for continuing to work on it. – Jonesey95 (talk) 13:16, 4 November 2022 (UTC)Reply

Link to transcluded article

edit

I have changed the transclude function to link to the article from which an image is transcluded. Previous discussion: User talk:Certes#Big idea. Certes (talk) 21:47, 22 May 2021 (UTC)Reply

Copy to Commons?

edit

@Evad37: Just following up to see, with the recent improvements to the mobile version, if this is good to copy over to Commons? Thanks. — Rhododendrites talk \\ 14:34, 9 June 2021 (UTC)Reply

@Evad37: One more nudge on this and I'll leave you alone/find something different. :) — Rhododendrites talk \\ 17:09, 20 July 2021 (UTC)Reply
@Rhododendrites: Sorry, I haven't had much free time IRL to spend on wiki stuff. The pieces should be pretty much ready, and should be able to be copied over to commons – except I'm not sure what the modules are like over there, which might make it harder to put it all together. Plus article excerpt slideshows don't need to be a thing over on commons, but are part of the module here. Feel free to ping me again in a couple of weeks if I haven't gotten around to it by then, or leave a message on my talk page - Evad37 [talk] 05:18, 23 July 2021 (UTC)Reply
Copied over (without the transclusion stuff), and seems to be working fine!  Rhododendrites talk \\ 22:18, 25 July 2021 (UTC)Reply

Random pic from category

edit

Instead of lists; has anyone built a Random Slideshow from Category? Wouldn't it be much easier to have a "{PortalName} Portal Pictures" category? Mjquinn_id (talk) 19:58, 26 August 2021 (UTC)Reply

There is no way for a template or module to find out what pages are in a category (short of reading in every file in Wikipedia and scanning for "Category:Whatever"). Certes (talk) 20:31, 26 August 2021 (UTC)Reply