Module talk:Excerpt slideshow

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
WikiProject iconPortals  
WikiProject iconThis page is within the scope of WikiProject Portals, a collaborative effort to improve portals 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.
Template This module does not require a rating on the project's quality scale.
Note icon
See also: List of Portals

Very useful[edit]

 – Evad37 [talk] 06:24, 24 July 2018 (UTC)[reply]

I want this! Next step would be to combine with {{Transclude list item excerpt}} as {{Transclude list item excerpts as random slideshow}}, to make a really powerful automation tool to make a portal from an outline list. · · · Peter (Southwood) (talk): 05:13, 25 June 2018 (UTC)[reply]

Losing list formatting[edit]

This template seems to be losing the formatting of bulleted lists. See example.

The template {{Transclude lead excerpt}} seems to do it right. See example.

Gas planning is one of the stages of scuba gas management. The other stages include:

  • Knowledge of personal and team members' gas consumption rates under varying conditions
    • basic consumption at the surface for variations in workload
    • variation in consumption due to depth variation
    • variation in consumption due to dive conditions and personal physical and mental condition
  • Monitoring the contents of the cylinders during a dive
  • Awareness of the critical pressures and using them to manage the dive
  • Efficient use of the available gas during the planned dive and during an emergency
  • Limiting the risk of equipment malfunctions that could cause a loss of breathing gas (Full article...)

so the module is working. Cheers, · · · Peter (Southwood) (talk): 12:07, 28 July 2018 (UTC)[reply]

This is from a limitation of the gallery syntax, where the caption can't contain any new lines, so the module changes them to <br> tags. It might be possible for the module to change a wikitext list into a html list with <ul>...</ul> and <li>...</li> tags. But allowing for sublists makes it complicated. - Evad37 [talk] 03:46, 29 July 2018 (UTC)[reply]
@Pbsouthwood:  Fixed, mostly. If different types of list are mixed together, e.g. a numbered sublist (lines beginning *# or similar), then the sublist will still be broken. - Evad37 [talk] 04:51, 14 September 2018 (UTC)[reply]
I can't remember what it used to look like:-/ Current version is nearly right – I see that the return to a lesser indent is missing its bullet. Cheers, · · · Peter (Southwood) (talk): 05:41, 14 September 2018 (UTC)[reply]
@Pbsouthwood:  Fixed. (Before, the items would have the "*" characters at the start of the line instead of proper bullet points) - Evad37 [talk] 07:01, 15 September 2018 (UTC)[reply]
Thanks for the reminder, and latest tweak. Cheers, · · · Peter (Southwood) (talk): 08:58, 15 September 2018 (UTC)[reply]

Option for title display[edit]

Would it be possible to extract the title of the selected excerpt and display it at the top of the rendering? Some excerpts are not very obvious about their topic, and particularly with the slideshow arrangement, it would help to identify what the excerpt is about. In the case of a section, the full section title would probably be most generally useful. · · · Peter (Southwood) (talk): 17:11, 28 July 2018 (UTC)[reply]

For lead excerpts at least, it sounds more like a content issue that should be addressed at the individual articles – lead sentences should be making it obvious what the topic of the article is (MOS:LEAD). If they do that properly, than showing the page title as well is superfluous. For sections, showing the article title and section makes sense, but should probably be done at Module:Excerpt rather than here. - Evad37 [talk] 03:40, 29 July 2018 (UTC)[reply]
True, but most portals created using the new structure are going to include some articles with badly formed leads, and having the title displayed may reduce confusion in the reader. It is not reasonably practicable to check every lead, and new articles will be added which will be included automatically. Some of them will have poorly formed leads. · · · Peter (Southwood) (talk): 05:46, 14 September 2018 (UTC)[reply]

Images not rendering properly[edit]

Evad37 - The images produced by this template at Portal:India are rendering badly (they seem to be getting cut off after a certain width). Could you check this up.  — FR+ 05:34, 6 August 2018 (UTC)[reply]

@FR30799386: I can't see any issues with the excerpt slideshows on that portal, at least on my computer.
  • Can you provide a screenshot of the problem? (see WP:WPSHOT for instructions)
  • Can you test on other browsers or other computers?
  • Does the same problem happen if you use {{transclude lead excerpt}}? (If so, that would indicate a problem with Module:Excerpt rather than this module.)
- Evad37 [talk] 13:04, 6 August 2018 (UTC)[reply]
A screenshot of the problem
Evad37 - I have uploaded added the screenshot of the problem. — FR+ 10:51, 7 August 2018 (UTC)[reply]

Template:Transclude list item excerpt causes Bogus file options lint errors[edit]

Template stops transcluding lead when it encounters a | character[edit]

See Portal:A-ha and Minor Earth Major Sky.

Transclusion stops at the | character, when it shouldn't. Dreamy Jazz 🎷 talk to me | my contributions 10:57, 5 September 2018 (UTC)[reply]

@Evad37: @Certes:. Pinging as still a present problem. Dreamy Jazz 🎷 talk to me | my contributions 21:29, 13 September 2018 (UTC)[reply]
This one works with {{Transclude lead excerpt}}, but with {{Transclude excerpts as random slideshow}} it's stopping as described: immediately before a "|" character in the text (not wikitext in a piped link etc.) early in the source article Minor Earth Major Sky. @Evad37: I guess that the "|" prematurely terminates a parameter, perhaps to #tag:gallery in Module:Random slideshow. Can you gsub it to {{!}} or something? Certes (talk) 00:23, 14 September 2018 (UTC)[reply]
@Dreamy Jazz and Certes:  Fixed. Ended up needing to replace pipes not within links or templates with the html enitity &#124; so that it wouldn't get expanded again by Module:Random slideshow - Evad37 [talk] 02:29, 14 September 2018 (UTC)[reply]

Problems when including a page with a mathematics formula[edit]

Portal:Tires uses this module via

{{Transclude list item excerpts as random slideshow | paragraphs=1-2 | files=1 | more=
| Template:{{PAGENAME}} | }}

and creates maths rendering error when transcluding Slip angle which has a mathematical expression at the end of its second paragraph.

The slip angle, <math>\alpha</math> is defined as <br />
<center><math>\alpha \triangleq -\arctan\left(\frac{v_y}{|v_x|}\right)</math></center>

The error message generated is

Failed to parse (syntax error): {\displaystyle 
              \alpha \triangleq -\arctan\left(\frac{v_y}\right)}

It looks like the {|v_x|} part got stripped, perhaps thinking this is a table rather than part of a math's formula. --Salix alba (talk): 12:07, 8 September 2018 (UTC)[reply]

Annotated links in lists[edit]

Evad37 I think I may be repaying your helpfulness by creating more work. Sorry about that.

I have made a template {{Annotated link}} which is useful in lists to annotate the item using the short description from the linked article. This obviously changes the format and now this template does not recognise the links any more - they are now inside {{Annotated link|Article title}}, where article title represents the link.

Can this be managed without excessive overhead? An example can be seen in Portal:Underwater diving in box Diving modes, which gets a list from Outline of underwater diving#Modes of underwater diving, which now has examples of the Annotated link template. · · · Peter (Southwood) (talk): 08:12, 13 September 2018 (UTC)[reply]

@Pbsouthwood:  Done - Evad37 [talk] 10:28, 13 September 2018 (UTC).[reply]
Also fixed in Module:Excerpt, so that {{Transclude linked excerpt}} and {{Transclude list item excerpt}} will work with annotated links. - Evad37 [talk] 10:36, 13 September 2018 (UTC)[reply]
Good work mate, Thanks, · · · Peter (Southwood) (talk): 12:09, 13 September 2018 (UTC)[reply]

This module is not rendering numbered lists or tabs using colons[edit]

Pinging @Evad37: and @Certes:

This module does not render numbered lists or tabs using colons. It is this module that has the problem, as this test on my sandbox confirms it works as normal for Module:Excerpt. See Portal:Sandgrouse and Order (biology). Thanks, Dreamy Jazz 🎷 talk to me | my contributions 20:14, 14 September 2018 (UTC)[reply]

 Fixed numbered lists. Colon markup is going to be more difficult, since it can be also be used with semi-colons as definition list markup. - Evad37 [talk] 07:50, 15 September 2018 (UTC)[reply]

Use with navboxes[edit]

This template is being used with navboxes to semi-automate portal construction, but as far as I can tell, only for the whole content of the navbox. Is it possible to extract a group from a navbox template, and ideally use the group title in the header and to select the group with its subgroups for a random slideshow? This way several selected article boxes could be populated from the same navbox. · · · Peter (Southwood) (talk): 19:15, 19 September 2018 (UTC)[reply]

Missing image[edit]

@Evad37: Portal:Buffalo Braves transcludes 1972–73 Buffalo Braves season which has {{NBA_season|logo = [[Image:Buffalo Braves logo.png|200px]]…}}, but Image:Buffalo Braves logo.png doesn't exist. Can {{Transclude list item excerpts as random slideshow}} ignore the |logo= parameter here? (Also, the image would also probably be non-free if it did exist, though that's hard to guess without an image.) Thanks, Certes (talk) 10:42, 21 September 2018 (UTC)[reply]

@Certes: This is a Module:Excerpt problem, per Template:Transclude_lead_excerpt/testcases#1972–73_Buffalo_Braves_season. Lua can access file data such as existence, but it is expensive. So its probably better to fix the articles where these occur. - Evad37 [talk] 05:29, 22 September 2018 (UTC)[reply]
@Evad37: Oops, you're right on both counts. I've fixed the article. Thanks for adding the test case. Certes (talk) 11:00, 22 September 2018 (UTC)[reply]

Page layout error[edit]

@Evad37: The Template:Transclude excerpts as random slideshow when used in the Portal:Sexuality presents a page formatting error. See the erro here

{{ Transclude excerpts as random slideshow | paragraphs=1-3 | files=1 | fileargs=left | more= | Bisexuality | Heterosexuality | Homosexuality | Asexuality | Condom | Female condom | Kama Sutra | Female genital mutilation | Age of consent | BDSM |
Prostitution of children | Margaret Higgins Sanger | Transgender | Polyamory | Paraphilia |
Safe sex | Sexual orientation | Alfred Kinsey | Sexual intercourse | Prostitution |
Masturbation | Hypersexuality | Sexually transmitted diseases | Birth control | Orgasm |
Phallic architecture | Comfort women | Clitoris | Lesbian | Monogamy |
Vagina | Human penis | Strip club | Stripper | Biology and sexual orientation |
Sexual dysfunction | Gender identity | Pedophilia | Anal sex }}

Guilherme Burn (talk) 15:01, 5 November 2018 (UTC)[reply]

I am getting the same problem on Portal:Minerals with the following code:
{{Transclude list item excerpts as random slideshow | paragraphs=1-2 | files=1 | more= | List of minerals | }} RockMagnetist (DCO visiting scholar) (talk) 17:29, 13 November 2018 (UTC)[reply]

Only lead images[edit]

In Portal:Geophysics, this template only displays the two images in the lead of Geophysics. RockMagnetist(talk) 16:52, 11 November 2018 (UTC)[reply]

Read more[edit]

@Evad37: We have a few slideshow items just saying "Read more... Read more...". (Sadly, the output is being ridiculed as proof by example that all portals are "shit".)

I've tracked this down and made a couple of changes in the sandbox. They affect makeGalleryArgs when excerpt consists of just "Read more". Firstly, a blank lead sets readmore_start_index to 1, so mw.ustring.sub(excerpt, 1, readmore_start_index-2) equals sub(excerpt, 1, -1) which is the whole string, and fails to remove the "Read more". I've changed the -2 to -1, and kept the leading space in readmore_text to compensate. Secondly, #excerpt needs to be checked again after removing "Read more" in case it just dropped below 10.

Please can you cast your eye over the code to see that it still looks reasonable? I've added a testcase for it here. The sandbox also includes your new constants which could be a good idea, depending where the best trade-off is between run time and content.

Thanks, Certes (talk) 01:33, 22 March 2019 (UTC)[reply]

Looks good Certes,  Done - Evad37 [talk] 02:23, 22 March 2019 (UTC)[reply]

Bizarre behavior[edit]

In Portal:Earth sciences, this template is broken in a very strange way. It is supposed to select from one of the links on Portal:Earth sciences/Selected articles, but always loads Geography of Indonesia, even though that article is not one of the links (although it used to be). No amount of twiddling with parameters or page reloading makes any difference. I use exactly the same syntax in Portal:Geophysics, and it works fine there. RockMagnetist(talk) 22:56, 23 May 2019 (UTC)[reply]

@RockMagnetist: It's actually picking List of volcanoes in Indonesia, which is the last entry on the Selected articles list. Removing that entry fixes things, though I'd prefer not to do that as it's a featured list. The volcano list starts with an <onlyinclude> section, instructing any transcluding page to hide the rest of the article. Constructing the portal puts this wikitext onto the same page as the other selected articles, so the portal duly hides the rest of the page, including the other selected articles. If you think that this portal stands any chance of not being killed off then I'll look into enhancing Module:Excerpt to deal with this syntax. Certes (talk) 23:17, 23 May 2019 (UTC)[reply]
Thank you, Certes. This portal is very likely to survive: I maintain both it and Portal:Geophysics, and the latter just survived an MfD. Indeed, some of the most active deletionists at that MfD consider Portal:Geophysics a model for how to use the new tools. Earth sciences is a broader subject and I have modified it using the same tools to get rid of one of the biggest problems with the old portals - content forking. RockMagnetist(talk) 23:41, 23 May 2019 (UTC)[reply]
 Fixed, thanks for the report. Certes (talk) 00:10, 24 May 2019 (UTC)[reply]
And thank you for fixing it so quickly! RockMagnetist(talk) 15:13, 24 May 2019 (UTC)[reply]

Move discussion in progress[edit]

There is a move discussion in progress on Template talk:Transclude selected current events which affects this page. Please participate on that page and not in this talk page section. Thank you. —RMCD bot 23:03, 31 July 2019 (UTC)[reply]

Change default "Read more..." link text[edit]

You are invited to join the discussion at Wikipedia talk:WikiProject Portals § Change default "Read more..." link text. —⁠andrybak (talk) 12:09, 6 November 2020 (UTC)[reply]

Why use Module:Excerpt/portals?[edit]

Hey! During some recent testing after a portal page was coming up under a tracking category due to a page being edited in a weird way, I noticed that this module explicitly used a /portal version of the Excerpt module. My question is - why? After some investigating (see this page (will break at some point, if it has, use this)), and I noticed that the module covers less edge cases, trips up easier, and is even considered "deprecated", so I'm unsure why its still in use for these templates. Is there something this sub-module covers thats critical to these templates but not found in the main module? If so, what? If a conversion to the main module is possible, that would probably be a good move. If not, then I could potentially work on sorting any issues between them. Aidan9382 (talk) 21:19, 21 June 2022 (UTC)[reply]

If you can make the slideshow work with Module:Excerpt then I don't see any reason not to. As you're probably aware, the history is that Module:Excerpt was created for portals (I wrote much of the code) then extended for articles (mainly by Sophivorus). The two namespaces have conflicting requirements – for example, portals strip references but articles retain them – and it proved more practical to develop their functionality separately. If one module can do both jobs, so much the better. I wasn't aware that Module:Excerpt/portals was "deprecated". Is that simply because it's used in portals which some editors would like to delete, or is there something specific about the code that needs attention? Certes (talk) 23:11, 21 June 2022 (UTC)[reply]
Well, I'm not particularly sure why its deprecated, but thats what it was saying within the code of Module:Excerpt/portals. I'd imagine its more akin to "out of date" than "deprecated", but I don't know. Features like stripping references are currently implemented within Module:Excerpt, so a swap may be possible, however I'm not gonna guarantee anything until I've read the entire thing and what its used for. If it is possible to convert, I probably will, but if not, it's not like /portals is falling apart, so its fine. Aidan9382 (talk) 05:02, 22 June 2022 (UTC)[reply]
why its deprecated, but thats what it was saying within the code of Module:Excerpt/portals – that's a question to User:Sophivorus, who've added the deprecation comment when Module:Excerpt/portals was created: Special:Permalink/975118421. It's not clear from the edit summary: Merge Module:Excerpt, Module:Excerpt/templates and Module:Excerpt/i18n. —⁠andrybak (talk) 12:09, 22 June 2022 (UTC)[reply]
Hi guys! Sorry for the delay, I'm kind of on holidays right now, will resume next week. @Certes I thought you'd seen the deprecation notice since I made it conspicuous, my bad. If I recall correctly, I put the notice based on this talk where you expressed that "I'm happy to treat my work as a proof of concept which I hope has provided some useful ideas for the more generic modules which can replace it." Still if you'd rather remove the notice, by all means do it! :-) @Aidan9382 Merging /portals into the main module would require adding an extra method or two to reproduce the missing behavior, for example the slideshows. If you feel like giving it a try, it would be a very valuable next step! Sorry if I can't give a more detailed or thoughtful reply right now, but as I mentioned, I'll resume properly next week, cheers! Sophivorus (talk) 00:29, 25 June 2022 (UTC)[reply]
To me, deprecated means "use something else instead", and we don't quite have anything else that does the job completely yet. If someone can enhance the main module to do everything that /portals does, then we can deprecate the /portals variant and perhaps even replace it by a require statement. Until then, I think we need it. Certes (talk) 09:59, 25 June 2022 (UTC)[reply]
@Certes Fair enough, I just removed the notice. @Aidan9382 Thinking a bit more about this, perhaps rather than adding methods to the main module, a better approach may be to write a new module that does what /portals does but using Module:Transcluder as much as possible. This would keep each module more modular, smaller and easier to understand, develop, maintain and update. Sophivorus (talk) 16:39, 25 June 2022 (UTC)[reply]
@Sophivorus: That sounds like a better idea. The /portals version does seem to contain a lot of functions used for specifically this, and the use of transcluder would probably help clear up a few of the minor problems with it just fine. I'll start taking a look, see what there is to this and what can be improved. Aidan9382 (talk) 16:49, 25 June 2022 (UTC)[reply]
Yes, if Module:Transcluder had existed when I worked on /portals (then called Module:Excerpt), I would certainly have used it rather than reinventing several wheels. We have extensive testcases that should give us confidence that a replacement does the job properly, and we may even fix a few bugs no one has spotted. Certes (talk) 17:48, 25 June 2022 (UTC)[reply]

To editors Aidan9382, Evad37, Andrybak, Sophivorus, Jackmcbarn and BrownHairedGirl:

Portal:Video games includes this markup:

{{Transclude list item excerpts as random slideshow | paragraphs=1-2 | files=1 | limit=10 | more=
|Portal:Video games/Recognized content
|section=Featured articles
}}

Among the articles listed in Portal:Video games/Recognized content#Featured articles is Super Columbine Massacre RPG!. In that article, immediately following the infobox is the following markup:

{{Columbine High School massacre}}

'''''Super Columbine Massacre RPG!''''' is a [[role-playing video game]] created by [[Danny Ledonne]] and released in April 2005. The game recreates the 1999 [[Columbine High School massacre|Columbine High School shootings]] near [[Littleton, Colorado]]. Players assume the roles of gunmen [[Eric Harris and Dylan Klebold]] and act out the [[massacre]], with flashbacks relating parts of Harris and Klebold's past experiences. The game begins on the day of the shootings and follows Harris and Klebold after their suicides to fictional adventures in [[Christian views on Hell|perdition]].

Ledonne had spent many years conceptualizing games, but never created one due to his lack of game design and programming knowledge. He was inspired to create a video game about Columbine by his own experience being bullied and the effect the shooting had on his life. The game represents a critique of how traditional media sensationalized the shooting (in particular the role of video games), as well as parodying video games themselves. ''Super Columbine Massacre'' was created with [[ASCII (company)|ASCII]]'s game development program [[RPG Maker 2000]] and took approximately six months to complete. Ledonne initially published the game anonymously, releasing an [[artist's statement]] about the work after his identity was revealed. ''Super Columbine Massacre'' was released for free online and attracted little attention until 2006, when widespread media coverage fueled hundreds of thousands of downloads.

If the random transclusion happens to bring in Super Columbine Massacre RPG!, it includes this:

<gallery class="switcher-container" mode="slideshow">
...
File:Blank.png|<span class="switcher-label" style="display:none"><span class="randomSlideshow-sr-only">Image #</span></span><div style="text-align:left;">{{Columbine High School massacre}}
...

(where # is a number from 1 to 10), which distills further to

<gallery>File:Blank.png|{{Columbine High School massacre}}</gallery>

which is Multiline table in list lint error. Template:Transclude list item excerpts as random slideshow needs to recognize templates that should not be brought in, and not bring them in. —Anomalocaris (talk) 08:46, 19 December 2022 (UTC)[reply]

@Anomalocaris: Thanks for the notice. Not too long ago I was doing related work on this module (and associated modules) to try and clear a seperate linter error (bogus image options), as well as introducing some formatting changes to help display some wikitext. Some of the discussion can be seen at Module talk:Excerpt and Module talk:Random slideshow. These linter issues have been happening for some time, though this one is new to me, so I'll look into fixing that (or finding what causes it at least). If this is a substantial issue in the meantime, or if I'm unable to find a satisfactory solution (I doubt this is a simple fix), It's probably safe to put it in the blacklist of Module:Excerpt/portals, which should fix the issue for now. Aidan9382 (talk) 09:18, 19 December 2022 (UTC)[reply]
Note that I'm fairly sure blacklisting templates is the normal approach taken in scenarios like this anyways judging from Module talk:Excerpt, so for now I've just blacklisted it anyways. Aidan9382 (talk) 09:36, 19 December 2022 (UTC)[reply]
Yes, blacklisting the template will omit the template's expansion from the portal if that's what's wanted here. Certes (talk) 09:50, 19 December 2022 (UTC)[reply]

Handling onlyincludes[edit]

I've come back to the goal of trying to fix all the bogus file options errors in the portal namespace caused by this module and its family, and I've managed to cut nearly every page out. However, the situation for Portal:Victoria was a little complicated. Some of the pages listed (1, 2) had an <onlyinclude>...</onlyinclude> tag in them, which was causing the module to try transclude something it really can't handle. Luckily, both of the articles using the tags weren't being transcluded at all, so it was safe to remove the tags. However, what's the best approach when this isn't an option? Based off my memory I don't think theres anything that can just bypass the onlyincludes in the code, and I've never seen this kind of situation before, so I'm not sure what a more proper fix would be here. Any ideas? Aidan9382 (talk) 19:43, 23 January 2023 (UTC)[reply]

Module:Excerpt/portals#L-575 has code to handle onlyinclude, if that helps. Certes (talk) 20:01, 23 January 2023 (UTC)[reply]
Let me clarify - that exact code is my problem. The slideshow attempts to grab some text to display for the article, but instead of getting the lead, it grabs the onlyinclude section, which isn't what we want, and also leads to linter errors in this specific scenario due to how complicated the sections are. Is there a way around that from a code side of things, or do we simply just have to re-format the article to work with the situation? Aidan9382 (talk) 20:21, 23 January 2023 (UTC)[reply]
I suppose we need to look at why the article uses onlyinclude. I naively assumed that it would be for the rare occasions when we should only include the text within the tag and ignore the rest. We need to ask "what else transcludes the article?" and "how does onlyinclude help those transclusions?" In these examples, the answers were "nothing" and "it doesn't, so get rid of it". In general, onlyinclude may not be the best solution to whatever problem it was trying to solve. For example, Portal:The Simpsons was unable to transclude the lead of The Simpsons, because the article had onlyinclude around the episode count so that other articles could just transclude the entire article to get an up-to-date number. (D'oh!) We fixed that by ripping out the inappropriate noinclude tag and using {{Template parameter value|The Simpsons|Infobox television|num_episodes}} in the transcluding pages. Certes (talk) 21:00, 23 January 2023 (UTC)[reply]
Yeah alright, that makes sense. Thanks for the example, too. I'll keep that in mind for the future. Aidan9382 (talk) 21:06, 23 January 2023 (UTC)[reply]