Module talk:Excerpt/Archive 1
![]() | This is an archive of past discussions about Module:Excerpt. Do not edit the contents of this page. If you wish to start a new discussion or revive an old one, please do so on the current talk page. |
Archive 1 | Archive 2 | Archive 3 | Archive 4 |
Paragraph selection not working

I have tried using this template in Portal:Earth sciences/Selected article/2, selecting for the first two paragraphs, and it is transcluding all of them. RockMagnetist(talk) 17:08, 27 April 2018 (UTC)
- Fixed in Portal:Earth sciences/Selected article/2. The paragraph selection option is a named parameter, so the template needs paragraphs=1-2 rather then just 1-2. I'll see if I can make the documentation clearer. Certes (talk) 17:41, 27 April 2018 (UTC)
- Thanks! RockMagnetist(talk) 23:36, 27 April 2018 (UTC)
A hidden template breaker

I ran into a curious problem with Portal:Earth sciences/Selected article/8. In a previous revision of Climate of India, there was a break in the middle of the caption of the third figure, and the transclusion displayed the figure as well as a badly formatted chunk of the caption in the lead. I didn't request a figure in the template. After I fixed the caption (this revision), it worked fine. RockMagnetist(talk) 23:36, 27 April 2018 (UTC)
- Thanks for the report. File: and Image: can contain nested wikilinks and I've been a bit lazy in parsing them (which speeds the module up). I'm assuming that they take up the rest of the line, which is usually but not always the case. I should probably fix that soon, but it's good that you've patched things up for now. Certes (talk) 00:11, 28 April 2018 (UTC)
- Yes, it's not urgent but I'll let you know if there are any more issues. RockMagnetist(talk) 02:05, 28 April 2018 (UTC)
- Fixed. Certes (talk) 14:02, 28 April 2018 (UTC)
- Yes, it's not urgent but I'll let you know if there are any more issues. RockMagnetist(talk) 02:05, 28 April 2018 (UTC)
"Bad argument #1 to 'title.new' (number or string expected, got nil)"
I keep seeing the error above (clicking on it links to line 16) on some of the selections at User:Waggers/sandpit/portal selection random. (If you don't see the error at first, click "purge" to select a different article). Annoyingly the error doesn't always occur - but seems to more often than not.
It seems to be indicating that the pagename variable is not populated, yet the same page name is fed to {{more about}}, which always seems to display correctly, and the supposed lack of a pagename is not captured and handled by line 7, which looks like it's testing for pagename=nil. Am I doing something wrong? WaggersTALK 13:04, 3 May 2018 (UTC)
- Thanks for the report. Whisper it quietly, but function
lead
(for Transclude lead excerpt) and functionrandom
(for Transclude random excerpt) are identical. They pick one of their unnamed parameters at random and treat it as an article title. In this case you're passing three unnamed parameters tolead
. If your random number is 3 then these are article3, paragraphs3 and leadimages3, which evaluate to "Jane Austen", "" and "" respectively. One time in three you show part of Jane Austen; two times in three you try to show the article "" and get an error message. I can change the module solead
ignores all unnamed parameters except the first (making it differ fromrandom
), and I'll see if I can put out a more helpful error message. I should probably also makerandom
ignore blank parameters and possibly try a different random number if it hits a missing article. Certes (talk) 13:35, 3 May 2018 (UTC)
- I see, thanks. My bad - I've now named those parameters in the call to {{Transclude lead excerpt}} (they should be
|paragraphs=
and|files=
instead of unnamed. Thanks v much for the quick response. WaggersTALK 15:06, 3 May 2018 (UTC)- Module changed as above. Choosing a random excerpt from "cat" and a bunch of invalid titles now always tells you what a cat is. I've also added errors= to show conventional Lua error messages rather than a blank excerpt. Certes (talk) 16:30, 3 May 2018 (UTC)
- I see, thanks. My bad - I've now named those parameters in the call to {{Transclude lead excerpt}} (they should be
Bug fix request

I would like to request a small bug-fix if possible. The Transclude Lead Excerpt template leaves out the Template:Rp. An example below (note the superscript “:11” after “integral part of the airline's business”):
Biman Bangladesh Airlines, commonly known as Biman (/biːmɑːn/ bee-mah-n, Bengali: [ˈbimaːn]), is the national flag carrier of Bangladesh. With its main hub at Hazrat Shahjalal International Airport in Dhaka, the airline also operates flights from its secondary hubs at Shah Amanat International Airport in Chittagong and as well as Osmani International Airport in Sylhet. The airline provides international passenger and cargo services to multiple destinations and has air service agreements in 42 countries. The headquarters of the airline, Balaka Bhaban, is located in Kurmitola, in the northern part of Dhaka. Annual Hajj flights, transporting tourists, migrants, and non-resident Bangladeshi workers and the activities of its subsidiaries form an integral part of the corporate business of the airline.
Created in February 1972, Biman enjoyed an internal monopoly in the aviation industry of Bangladesh for 24 years, until 1996. In the decades following its founding, the airline expanded its fleet and destinations but it was adversely affected by corruption and mismanagement. At its peak, Biman operated flights to 29 international destinations, extending from New York City in the west to Tokyo in the east. The airline was wholly owned and managed by the government of Bangladesh until 23 July 2007, when it was transformed into the country's largest public limited company by the Caretaker Government of Bangladesh. Since becoming a public limited company in 2007, the airline has reduced staff and begun to modernize its fleet. The airline had signed a deal with Boeing to buy ten new aircraft and options for ten more in 2008. After taking delivery of the new planes, Biman expanded its destinations and added in-flight amenities such as onboard internet, WiFi, mobile telephony and live TV streams.
During his visit to Dhaka in September 2023, French President Emmanuel Macron and then Bangladesh Prime Minister Sheikh Hasina announced the order of ten Airbus A350 aircraft for Biman. The Airbus order consists of the purchase by Biman Bangladesh Airlines of two A350F cargo aircraft and eight A350 passenger aircraft. The aircraft will be delivered in stages with two passenger A350 aircraft joining the Biman fleet first. Biman Bangladesh Airlines is certified as safe to fly in Europe by the European Union Aviation Safety Agency. In addition, Biman has also successfully passed the IATA Operational Safety Audit and since then, the airline has resumed flights to some of its previous destinations in Asia and Europe. In recent times, Biman Bangladesh Airlines has seen a marked improvement in punctuality, as well as in on-time flight performance, under its new management team. (Full article...)
Regards, Arman (Talk) 09:48, 6 May 2018 (UTC)
Done in Module:Excerpt. @Armanaziz: thanks, good catch. Certes (talk) 18:50, 6 May 2018 (UTC)
Bug?

Default for parameter files
appears to be no files rather than all files as stated on the description page. · · · Peter (Southwood) (talk): 04:51, 7 May 2018 (UTC)
- I see that the description varies in different places. I will fix it to comply with reality. · · · Peter (Southwood) (talk): 04:54, 7 May 2018 (UTC)
issue
On the CKB Wikipedia nothing seems to be happening when I use the Transclude lead excerpt template. It doesn't display any text from the main article. Do you think this is because it doesn't support RTL languages or I'm doing something wrong? I used it here.--◂ épine Ⓥ 01:01, 2 May 2018 (UTC)
- I don't know! To be honest, I wrote the alpha draft of the module with English Wikipedia in mind and didn't think very hard about internationalisation at this early stage. I am quite surprised that the module has been taken up so widely and so quickly. Please can you provide links to the module and the template on CKB Wikipedia? I've not seen Sorani before and I can't actually work out how Excerpt was being used in the Evanescence portal. Arabic Wikipedia seems to be using the module ar:وحدة:Excerpt with RTL text in ar:بوابة:تشريح. Hope that helps, Certes (talk) 01:29, 2 May 2018 (UTC)
- @Certes: this is the template and this is the module. Note: @مصعب: has edited the coding today. Also please ping me for future responses.--◂ épine Ⓥ 16:55, 13 May 2018 (UTC)
- @Épine: It works on Kurdish wiki. Look here brother. I am happy to help.-مصعب (talk) 17:08, 13 May 2018 (UTC)
- @مصعب: I see, it seems I wasn't using the template quite correctly, however, in my defense, the documentation for the template is not really clear. That's understandable since it's still being worked on.--◂ épine Ⓥ 19:54, 13 May 2018 (UTC)
- @Épine: Please feel free to suggest what is unclear in the documentation, or just go ahead and improve it. But as you say, although several portals are already using the templates, this is an alpha module and is still being developed. The module was specifically aimed at a current initiative to improve English portals, but if other wikis are using the software then perhaps we should think more seriously about making it work better in other languages, including RTL text. Certes (talk) 20:46, 13 May 2018 (UTC)
- You should definitely keep the other wikis in mind. We rely on these types of modules more than you think.--◂ épine Ⓥ 21:15, 13 May 2018 (UTC)
- @Épine: Please feel free to suggest what is unclear in the documentation, or just go ahead and improve it. But as you say, although several portals are already using the templates, this is an alpha module and is still being developed. The module was specifically aimed at a current initiative to improve English portals, but if other wikis are using the software then perhaps we should think more seriously about making it work better in other languages, including RTL text. Certes (talk) 20:46, 13 May 2018 (UTC)
- @مصعب: I see, it seems I wasn't using the template quite correctly, however, in my defense, the documentation for the template is not really clear. That's understandable since it's still being worked on.--◂ épine Ⓥ 19:54, 13 May 2018 (UTC)
- @Épine: It works on Kurdish wiki. Look here brother. I am happy to help.-مصعب (talk) 17:08, 13 May 2018 (UTC)
Transclude lead excerpt not removing {{sfnm}}

The transclude lead excerpt template does not remove the {{sfnm}} template, which is a template for multiple refrences in one note. Dreamy Jazz (talk) 15:07, 20 May 2018 (UTC)
- @Dreamy Jazz: I've now attempted to fix that problem, but I can't find an example of Sfnm being used in the lead. Please can you check the page which was broken, and confirm whether it has improved? Thanks, Certes (talk) 15:28, 20 May 2018 (UTC)
- @Certes: I can no longer see them on Portal:Argentina, which is the place I noticed the problem. It seems to be fixed, thanks Dreamy Jazz (talk) 16:02, 20 May 2018 (UTC)
Possible bug with italics and bolding

I have an instance of failing to return to unitalicised text on text starting The '''SS ''Vienna''''' was built in 1873 . Text starting with "Vienna" and continuing through "was built..." until next instance of '' all in italics. Possibly misinterpreting the '''''. See below
The SS Vienna was built in 1873 during the era when steamers were built with sail rigging. She had a 19 year career marked with maritime incidents including sinking when she was just three years old. She sank for her final time in fair weather in Whitefish Bay in Lake Superior after she received a mortal blow when she was inexplicably rammed by the steamer Nipigon. Although there were no deaths when the Vienna sank for the last time, more than 100 years later her wreck claimed the lives of 4 scuba divers, the most of all the wrecks in the Whitefish Point Underwater Preserve that now protects her as part of an underwater museum. Her wreck was stripped of artifacts that resulted in the Michigan Department of Natural Resources seizing her artifacts in a raid on the Great Lakes Shipwreck Museum in 1992. Her artifacts are now on display in this museum as loan from the State of Michigan. (Full article...)
Cheers, · · · Peter (Southwood) (talk): 10:20, 22 May 2018 (UTC)
- @Pbsouthwood:
Fixed. Thanks for the report. The nested apostrophe parser now handles partially italic titles in bold, such as '''SS ''Vienna''''' and '''''Billboard'' 200'''. I've also tweaked the image parsing so that it displays the ship image in preference to the U.S. flag. Certes (talk) 12:20, 22 May 2018 (UTC)
- Thank you for fixing it. The least we can do as users is try to give you accurate bug reports. It is getting better than it was, so a net gain for the project. · · · Peter (Southwood) (talk): 12:37, 22 May 2018 (UTC)
Request to include image from infobox

Many article leads only have an image in the infobox. These would be desirable in the transcluded leads for portal selected articles if parameter files
is set. It would also be better to specify image size in the template than to transclude the size used in the article, which is often much too large for the portal frame. · · · Peter (Southwood) (talk): 04:38, 7 May 2018 (UTC)
- I agree that these are good ideas. In theory, an infobox which uses full image syntax per {{Infobox/doc#Illustration image}} should be easy to parse. In practice, each project has invented its own syntax such as {{Infobox film/doc#Image}} (which also has optional alt= and image_size= parameters). I'll have a look at it but it's probably better to leave the feature out than to implement it unreliably.
- I could add an image size (or a list of sizes for multiple images?), but would it be better simply to use the [[File:...]] syntax outside the template? If the article changes to use a different image, we may well want to change the size in the excerpt too, rather than have it automatically apply the sizing chosen for a different image. Certes (talk) 09:35, 7 May 2018 (UTC)
- Possibly my ignorance will show here, but how difficult would it be to extract just the file name and the caption, and combine them as a default size thumbnail at the top of the excerpt? · · · Peter (Southwood) (talk): 18:03, 7 May 2018 (UTC)
- It seems to be almost getting the image from the infobox at James Talacek here:
[[File:NEEMO 14 James Talacek wearing LifeShirt.jpg|Talacek inside Aquarius during the |thumb| James Raymond Talacek is an American professional aquanaut with the University of North Carolina Wilmington (UNCW). He serves as Oceanographic Field Operations Manager at Aquarius Reef Base, the world's only undersea research laboratory. Read more...
- It seems to have hit a problem with a link in the caption. · · · Peter (Southwood) (talk): 11:19, 22 May 2018 (UTC)
- Yes: it misreads the | within the piped link as ending the infobox's caption= parameter. I'll see what I can do, but a bulletproof wikitext parser would take years to write and shouldn't really go in such a specialised module. Certes (talk) 12:23, 22 May 2018 (UTC)
- Whatever you can do is appreciated. Cheers, · · · Peter (Southwood) (talk): 12:33, 22 May 2018 (UTC)
Fixed, though that bit of code is more complex than I'd have liked. I see a separate bug with his name not being wikilinked. I'll take a look at that next. Certes (talk) 14:46, 22 May 2018 (UTC)
- Name linking bug also fixed. (The long image caption made it appear that the bold text occurred too late in the article to be a synonym for its title.) Certes (talk) 14:59, 22 May 2018 (UTC)
- Yes: it misreads the | within the piped link as ending the infobox's caption= parameter. I'll see what I can do, but a bulletproof wikitext parser would take years to write and shouldn't really go in such a specialised module. Certes (talk) 12:23, 22 May 2018 (UTC)
- Possibly my ignorance will show here, but how difficult would it be to extract just the file name and the caption, and combine them as a default size thumbnail at the top of the excerpt? · · · Peter (Southwood) (talk): 18:03, 7 May 2018 (UTC)
Idea
It would be really helpful if the module could include the infobox picture in the excerpt instead of ignoring it completely.--◂ épine Ⓥ 04:14, 22 May 2018 (UTC)
- I've made some changes today which should make the picture appear more often. The problem is that there are so many ways to "hide" an image in an infobox. One example I've just added support for: {{Infobox ship image}} names its parameter
Ship image=
rather than the more commonimage=
. I can't just take anything containing the string "image", because we don't want parameters such as map_image. If you're seeing the problem on a non-English wiki then it may be an internationalisation issue (because infoboxes on that wiki name their parameters using non-English words that I didn't think of). Certes (talk) 15:09, 22 May 2018 (UTC)
FA stars transcluded?

It looks like the code for the FA star is being transcluded on Portal:Underwater diving. I checked by taking out that specific transclusion (Underwater diving), but it took a few tries, so I think it does it for all FA articles - there can be up to three in that portal. Cheers, · · · Peter (Southwood) (talk): 11:58, 23 May 2018 (UTC)
- @Pbsouthwood: Clicking the star takes me to WP:Featured pictures, so I think it may be coming from an image rather than a transcluded article excerpt.
- Most FA display their star using {{featured article}} at the top (which gets removed along with the rest of the heading tag junk) or at the bottom (which gets removed along with the non-lead text). It is possible that someone buried the tag in the middle of the lead instead, in which case it will display the star, but without knowing which article is causing a problem that's hard to verify. I've changed the module to explicitly remove that sort of template wherever it appears, just in case. Certes (talk) 12:46, 23 May 2018 (UTC)
Problem with custom templates

On a very few pages, custom templates are used that are not needed for Transclude lead excerpt (such as {{Mithun Chakraborty sidebar}} and although templates like this can be removed, we could not always prepare for all eventualities. I propose that a parameter is added that allows removal of certain templates that would be included. Dreamy Jazz (talk) 22:04, 24 May 2018 (UTC)
- @Dreamy Jazz:
Fixed. Portal:Bengali cinema/Selected biography/7 no longer transcludes the sidebar from Mithun Chakraborty. That article positions the sidebar unusually at the end of the lead. The module removes templates found before the lead, but retains templates within or at the end of the lead unless they're on a blacklist. I've now changed Module:Excerpt to blacklist sidebars. Certes (talk) 22:31, 24 May 2018 (UTC)
This template does not remove {{UN_Population|ref}}

The template {{UN_Population|ref}} is not removed when transcluding introductions. See Portal:Benin for example. Dreamy Jazz (talk) 09:53, 25 May 2018 (UTC)
- @Dreamy Jazz:
Done. I've updated the module to keep such templates but strip out a |ref or |shortref parameter. There's a risk of catching parameters where "ref" has some other meaning, but I think it's low. Several templates work this way, including some obscure ones, so I don't think it's practical to maintain a list. Certes (talk) 10:59, 25 May 2018 (UTC)
This template is removing {{nihongo}}

As on Portal:Ancient Japan/Selected article/5 and Portal:Ancient Japan/Selected article/1, the {{nihongo}} tag is removed. This should not be removed, as it removes the page title from the lead. Dreamy Jazz (talk) 20:03, 29 May 2018 (UTC)
- Yes, the module removes templates which occur before the lead, because they're usually not wanted. Here, {{nihongo}} is part of the lead but that's not obvious. Perhaps I can persuade it to retain templates which are before but on the same line as the first unadorned text in the lead. Certes (talk) 20:22, 29 May 2018 (UTC)
- This also seems to cause a problem with the paragraph transclusion (see Portal:Ancient Japan/Selected article/5). It seems to include a small amount from the fourth paragraph, even though I have defined it not to. This problem only seems to happen if the paragraph parameter is defined (not seen at Portal:Ancient Japan/Selected article/1). Dreamy Jazz (talk) 20:25, 29 May 2018 (UTC)
- That's a useful example and I think it shows the same problem. Like paragraph 1, paragraph 4 starts with a template. Templates at the start of a paragraph are not yet being recognised as part of the paragraph, so the module does not understand that paragraph 4 has already started. Certes (talk) 20:33, 29 May 2018 (UTC)
- This also seems to cause a problem with the paragraph transclusion (see Portal:Ancient Japan/Selected article/5). It seems to include a small amount from the fourth paragraph, even though I have defined it not to. This problem only seems to happen if the paragraph parameter is defined (not seen at Portal:Ancient Japan/Selected article/1). Dreamy Jazz (talk) 20:25, 29 May 2018 (UTC)
- @Dreamy Jazz:
Fixed. Templates which are followed by text which is not a template are now treated as part of that text rather than as a template. Certes (talk) 21:43, 29 May 2018 (UTC)
Removal of "citation needed"-like templates
@Certes: I know the module already removes {{cn}} but it misses several other in the same vein. See here for details. — AfroThundr (u · t · c) 11:46, 1 June 2018 (UTC)
Paragraphs and images parameters

I assume that the "paragraphs" parameter will select the same paragraphs for all articles in the group, and the "files" parameter will do the same. How is this useful? Most articles would need different paragraphs and files for optimum display. This feature only makes sense for a single selected article. If I am wrong, an explanation would be helpful. Cheers, · · · Peter (Southwood) (talk): 06:56, 30 April 2018 (UTC)
Paragraphs=
andfiles=
exist because the Lua module is shared with {{Transclude lead excerpt}} and it was easier to provide those features than to remove them.Paragraphs=1,3,5
makes no sense unless the articles being transcluded all follow one strict pattern. However, something likeparagraphs=1-4
may be useful to keep extracts reasonably short without tailoring each one individually. (If the lead contains fewer than four paragraphs, it quietly includes them all.)Files=1
includes the article's first image if any. That sounds like a good thing to do, especially if we enhance the module to lift an image from the infobox.- As an aside, I've called the parameter
files=
rather thanimages=
because it counts audio samples, etc. too. (They're hard to distinguish, especially if a new filename suffix appears in future.) I could add images as a synonyms but it might be confusing when it pulls out something that's not a picture. - At least this way anyone who thinks my way can use the parameters, and anyone who prefers your approach can omit them. Certes (talk) 08:54, 30 April 2018 (UTC)
- Update: despite its name, files= now chooses only images, not other media such as audio files. Certes (talk) 16:52, 1 June 2018 (UTC)
Images

I'm currently seeing that images grabbed from articles will give the full thumbnail in return. I would ask if it's possible to resize an image when calling the template but I believe unlogged users will still see the default thumbnail size? – TheGridExe (talk) 12:50, 1 June 2018 (UTC)
- I wrote the image code behind this template but I don't know the answer to that question. Perhaps someone else can help. One problem is that the template chooses randomly between articles with different images, so it's hard to find one size that suits them all. Originally I left the images at the same size used in the article but that was unpopular, so I picked thumbnail as a good compromise. Certes (talk) 16:52, 1 June 2018 (UTC)
Are the tags {{what?}} and {{Primary source inline}} supposed to be removed?

Are the tags {{what?}} ({{Clarify}}) and {{Primary source inline}} supposed to be removed? As from my experimentation {{Citation needed}} is removed, so I would presume that the same would go with the other two tags. See an example at Portal:Bangladesh/Selected_article/14 Dreamy Jazz (talk) 10:43, 1 June 2018 (UTC)
- This makes sense to me. Those should only really appear on the main article. — AfroThundr (u · t · c) 11:18, 1 June 2018 (UTC)
Fixed: Module:Excerpt now removes "clarification needed", "Primary source inline" and their dozens of aliases. Certes (talk) 17:24, 1 June 2018 (UTC)
This template fails when using a wikitable in the introduction

See Portal:Ancient Japan/Selected article/4 and National Treasure (Japan). The wiki table causes a strange result and returns some of the wikitable code and no text from the lead. Dreamy Jazz (talk) 20:14, 29 May 2018 (UTC)
Comment: It seems to be due to the way that this template is recognizing the wikitable. It seems to see each row of the wikitable is seen as a paragraph. Dreamy Jazz (talk) 20:19, 29 May 2018 (UTC)
- I have reverted the changes on the selected article. Dreamy Jazz (talk) 20:20, 29 May 2018 (UTC)
- I never thought of someone putting in a table before the lead had even started! I think it would normally work, but in this case it's complicated by the presence of images which are stripped out leaving a barely legal table syntax. Unless someone has a bright idea, I think we may have to draw the line at this one: the risk of adding extra complexity to handle such an unusual format would probably outweigh the advantages. Certes (talk) 20:29, 29 May 2018 (UTC)
- Ok, thanks. Dreamy Jazz (talk) 21:52, 29 May 2018 (UTC)
- These templates respect the noinclude tag, so one option is to mark
<noinclude>problematic text</noinclude>
thus. Certes (talk) 11:27, 2 June 2018 (UTC)
Short description and DISPLAYTITLE

Hi Certes. The template appears to transclude the short description and DISPLAYTITLE templates. These are not useful. DISPLAYTITLE seems to be ignored and only triggers a warning in edit mode, but the transcluded short description overrides the portal's own short description, as it is later in the page code, which is a problem. Cheers, · · · Peter (Southwood) (talk): 14:47, 18 June 2018 (UTC)
- @Pbsouthwood: Thanks; I'll add them to the removal list. I was hoping that they would only appear before the lead. To help with testing, please do you have any real-world examples of where they cause a problem? Certes (talk) 15:19, 18 June 2018 (UTC)
- Certes, I noticed them while working on Portal:Underwater diving. One of the cases that came up was Kursk submarine disaster for DISPLAYTITLE (it has italics in the title). The short description problem is not happening at the moment. Either it has been fixed or it is intermittent and only happens in some cases. Unfortunately I didn't record the short descriptions that came up so can't track down which articles were responsible. I will do that if it happens again. · · · Peter (Southwood) (talk): 16:02, 18 June 2018 (UTC)
- Aha! Kursk is (quite correctly) using the {{DISPLAYTITLE:… magic word rather than the {{DISPLAYTITLE|… template. I'll check for that too. Certes (talk) 16:09, 18 June 2018 (UTC)
- I've set up excerpts from Kursk and the similar Sinking of the Rainbow Warrior in my sandbox and they work fine. My sandbox also wikilinks the Warrior article near the start of the lead, but the Portal page doesn't. Failing to wikilink italicised titles is a bug that I fixed on 22 May. I suspect that purging the portal page would fix this problem. I've not done that as it would destroy the evidence, but please feel free to go ahead. You may have to try a few times before an italic title appears! Certes (talk) 16:39, 18 June 2018 (UTC)
Warning: Display title "<i>Kursk</i> submarine disaster" was ignored since it is not equivalent to the page's actual title.
is still coming up occasionally in edit mode. Purging resets the random selection, so it will only happen when the Kursk or Rainbow Warrior article is selected. The short description override could actually cause confusion in a mobile search, so relatively important to be fixed, but it has not come up recently, so may be fixed.Warning: Display title "Portal:Underwater divingUnder '<b></b>" was ignored since it is not equivalent to the page's actual title.
has also come up a couple of times, but may be unrelated. I have no idea what is causing it or how to track it down. I assume it is called from one of the randomising templates, because it only comes up occasionally, but I don't know of anything in any of the lists for random display that would refer to a portal. · · · Peter (Southwood) (talk): 04:44, 19 June 2018 (UTC)- @Evad37: From experiment, this seems to be caused by
local expandedContent = frame:preprocess(text)
, which now runs on every template to check that it's not an infobox. Can we run this check in some other way? This is also an expensive call, which may be a problem for portals that quote from many articles each with many templates. Certes (talk) 10:02, 19 June 2018 (UTC)- Would using
frame:expandTemplate
be any better? It would just need the template name to be extracted, which isn't difficult (the args can probably just be left out, since it only needs to check if there's a table with the class 'infobox' in the output). - Evad37 [talk] 10:44, 19 June 2018 (UTC)- Probably. It's worth a try if we can't find a cheaper way. DISPLAYTITLE is a special case because it's normally used as a magic word (with colon), though the deprecated template of that name (with |) also works, but it would be good to solve the more general problem. I think most infoboxes produce a table with class list including infobox (for example,
mw.getCurrentFrame():expandTemplate{title = "Infobox journal"}
produces <table class="infobox hproduct"…), so we could match something like<table class="[^"]*infobox
in the output (%s* etc. omitted for clarity). Certes (talk) 11:01, 19 June 2018 (UTC)- Some boxes construct a table out of wikitext though, e.g. {{Subspeciesbox}} calls {{Taxobox/core}} which outputs {| class="infobox biota"... rather than a
<table>
element - Evad37 [talk] 11:33, 19 June 2018 (UTC)- I think that's now all fixed. I've also blocked a few more reference syntaxes. Portal:Underwater diving still shows one ref, but that's from #section-h:Outline of underwater diving and not from this template. Certes (talk) 10:47, 20 June 2018 (UTC)
- Looks good at the moment. Thanks. · · · Peter (Southwood) (talk): 12:58, 20 June 2018 (UTC)
- I think that's now all fixed. I've also blocked a few more reference syntaxes. Portal:Underwater diving still shows one ref, but that's from #section-h:Outline of underwater diving and not from this template. Certes (talk) 10:47, 20 June 2018 (UTC)
- Some boxes construct a table out of wikitext though, e.g. {{Subspeciesbox}} calls {{Taxobox/core}} which outputs {| class="infobox biota"... rather than a
- Probably. It's worth a try if we can't find a cheaper way. DISPLAYTITLE is a special case because it's normally used as a magic word (with colon), though the deprecated template of that name (with |) also works, but it would be good to solve the more general problem. I think most infoboxes produce a table with class list including infobox (for example,
- Would using
- @Evad37: From experiment, this seems to be caused by
- Certes, I noticed them while working on Portal:Underwater diving. One of the cases that came up was Kursk submarine disaster for DISPLAYTITLE (it has italics in the title). The short description problem is not happening at the moment. Either it has been fixed or it is intermittent and only happens in some cases. Unfortunately I didn't record the short descriptions that came up so can't track down which articles were responsible. I will do that if it happens again. · · · Peter (Southwood) (talk): 16:02, 18 June 2018 (UTC)
- On a related point, Portal:Underwater diving reads
{{Transclude random excerpt | Kursk submarine disaster#Salvage operation…
.#Salvage operation
is ignored. Respecting #section is an interesting idea for an enhancement but I'm not sure it would help here. The section beginsThe Russian government committed to raising the wreck…
and it would be a while before it reminds the reader what the article is about. (|section= works but is not designed for random picks as it would seek the same section name in all articles.) Certes (talk) 10:02, 19 June 2018 (UTC)
Image from Infobox

I understand that as of now the template cannot source images from the infobox. However, the image in the infobox is often the most representative image on the topic. Given this, can we have an enhancement in this template to include the images from infobox subject to free image license verification? Arman (Talk) 05:13, 21 June 2018 (UTC)
- The template does attempt to source images from the infobox, but fails on some specialised infobox templates which use unusual syntax. Please can you link to an example where it fails? We may be able to enhance the template to handle that case. Certes (talk) 10:36, 21 June 2018 (UTC)
Nice work

Next step would be to combine this with the slideshow functionality of {{Transclude excerpts as random slideshow}} as {{Transclude list item excerpts as random slideshow}}. · · · Peter (Southwood) (talk): 04:46, 25 June 2018 (UTC)
Collapsed infobox section begin

Peter Sellers is, somewhat appropriately I guess, acting strange. Please see User:Waggers/sandpit/peter, which consists only of {{transclude lead excerpt}}. I think it's something to do with the {{Collapsed infobox section begin}} template that appears inside the infobox. WaggersTALK 13:39, 25 June 2018 (UTC)
Fixed, thanks for the report. As you say, it wasn't handling the nested infobox templates well. Certes (talk) 16:20, 25 June 2018 (UTC)
Possible exclusion of low quality articles

Would it be possible to add a minimum article quality parameter? For example if you only want to display articles of B-class or better. eg | minimum-class=B
. Alternatively a parameter set that specifies all the classes that may be displayed, eg | class=C,B,GA
to display only articles of classes C, B, and GA would be more versatile, though I don't see any obvious use for it. Cheers, · · · Peter (Southwood) (talk): 05:03, 25 June 2018 (UTC)
- This template is designed to work in cooperation with JL-Bot, which can limit the source list to good and/or featured articles. However, it may be possible for Module:Excerpt to limit the scope as you suggest. We'd have the usual problem that editors find inventive alternatives to adding the expected text string, but at least that would be a right-side failure in that we'd display some other good article instead. It may involve substantial work, both in coding and in parsing talk pages at run time, especially for an article such as The Hague which has been assessed by multiple wikiprojects. Certes (talk) 11:36, 25 June 2018 (UTC)
- That should also work. Can JL-Bot be requested to include B-class? I don't remember that as an option, though it might be less processor intensive depending on how it identifies the class. If the check was made according to the category used by the WikiProject associated with the portal to filter out the unwanted articles it might be quicker. Actually I have no idea how JL-Bot goes about its allotted tasks, so may be making useless suggestions. Anyway, just in case something might work... Cheers, · · · Peter (Southwood) (talk): 17:53, 25 June 2018 (UTC)
- This may be relevant.· · · Peter (Southwood) (talk): 18:21, 25 June 2018 (UTC)
Bug reports

Hello. I've been playing around with using this on Portal:Scottish Islands and have encountered a few bugs...
- John Gregorson Campbell is also transcluding a TOC
- A few articles are failing to link the article title, presumably because it differs from the bold definition text: Rachel Chiesley, Lady Grange, HMS Royal Oak (08), HMS Vanguard (1909) and Scuttling of the German fleet in Scapa Flow
- Some article excerpts are failing to acquire any image, despite a non-map image being present eg Dubh Artach, Cuillin, Fingal's Cave
Thanks for any assistance with these! Espresso Addict (talk) 20:37, 12 July 2018 (UTC)
- @Espresso Addict: I've updated the image detection code, can you check if there's any still missing an image? - Evad37 [talk] 08:58, 13 July 2018 (UTC)
- Thanks, @Evad37:, that looks a lot better. As far as I can tell (the script started timing out all the time before I'd finished), the only ones missing an image now are Whisky Galore! (1949 film), which I assume is because it's correctly assessing the poster as copyright, and all the ones where the only infobox image is a generic map with a location dot.
- The only new problem I saw is that the caption for the Orkney image is wrong -- it shows the flag, but gives the caption for the coat of arms.
- There are still the other two issues noted above, and in particular quite a few articles aren't linking besides those I noticed earlier -- I can do you a list if that would help? Cheers, Espresso Addict (talk) 14:01, 13 July 2018 (UTC)
- For Orkeny, the problem is probably the order of paramneters – the module assumes that each caption parameter is for the immediately preceding image parameter. This edit [1] should fix it. I haven't yet looked at the code for the other issues, but the TOC is presumably from another template that needs to be removed by the code; and the article title link can probably be fixed for most cases by checking the non-disambiguate version of the title, i.e removing parentheses and everything after and including the final comma. - Evad37 [talk] 02:46, 14 July 2018 (UTC)
- Fixed the TOC issue - Evad37 [talk] 03:16, 16 July 2018 (UTC)
- @Espresso Addict: Fixed the bold text linking too (for most cases, probably) . - Evad37 [talk] 03:50, 16 July 2018 (UTC)
- There are still the other two issues noted above, and in particular quite a few articles aren't linking besides those I noticed earlier -- I can do you a list if that would help? Cheers, Espresso Addict (talk) 14:01, 13 July 2018 (UTC)
Placement of image in excerpt
It looks like the images are placed where they are found, so if the firat image is below the lead in the original that is where it will display in the excerpt. I suggest that stacking them on the right starting at the top of the box is more generally useful. Having a moderately long excerpt with an image below it creates a lot of non-functional whitespace. Cheers, · · · Peter (Southwood) (talk): 08:18, 13 July 2018 (UTC)
- Noting that Portal:Heavy metal has an example in the intro section (per Wikipedia talk:WikiProject Portals/Design#Portal:Heavy metal) - Evad37 [talk] 02:45, 16 July 2018 (UTC)
- An interesting idea. We'd be overriding layout choices made in the article, but maybe they don't apply to the excerpt. Perhaps we should stack images in the default way, respecting the module's fileargs=left flag or any other settings. (Arabic Wikipedia uses a copy of this module and prefers images on the left.) Certes (talk) 08:42, 16 July 2018 (UTC)
- Heavy metal has exactly the effect we should avoid. It would be nice to be able to choose which side the stack displays, but the images should generally not take up a lot more vertical space than the text, or we end up with big whitespace. Obviously this depends on page width, but for a wide screen it would be preferable if there is not an extra image below the bottom of the text. Alternating between left and right looks fine on a wide screen, but really bad when the text sandwiched between images gets narrow. Adjusting the display of images to respond to screen width would be nice, but is it feasible? Limiting column width might also be feasible. It may be good for redability - the eye finds the start of the next line more easily if the number of characters in the line is smaller. Some of this may be beyond the scope of templates, as the screen characteristics would have to be available.
- I don't think that overriding display choices made in the article is an issue. We already do that by not displaying infoboxes. The article may continue for hundreds of lines below the lead. Our excerpts may not even include the whole lead. Stacked images is the easy way to give an unsurprising effect and the highest probability of consistently acceptable display. We can't expect it to be infallible. · · · Peter (Southwood) (talk): 16:22, 16 July 2018 (UTC)
- @Pbsouthwood:
Done That sounds very reasonable. I've updated Module:Excerpt to output images first. The change shouldn't affect left or right positioning. Certes (talk) 17:13, 16 July 2018 (UTC)
- @Pbsouthwood: