Archive 1Archive 2Archive 3Archive 4

Undefined referenes through excerpt

I'm trying to sort out why 59th Venice Biennale gives errors about the reference "Artnews" being undefined. The text (and the reference definition) are brought in by {{excerpt}} from List of national pavilions at the 59th Venice Biennale. The source artilce renders without error, and I've done some poking at it to try to figure out what's wrong ... but nothing makes a fix.

Anyone able to help me sort it out please? - Mikeblas (talk) 22:38, 25 April 2022 (UTC)

References from quoted articles have the article name prepended, in this case <ref name="List of national pavilions at the 59th Venice Biennale Artnews">. This is to prevent clashes when both articles use the same name (commonly <ref name=":0"> etc.) for different citations. Certes (talk) 23:28, 25 April 2022 (UTC)
Is that relevant here? I don't think it is becuawe 59th Venice Biennale doesn't invoke any references defined in the excerpted text. -- Mikeblas (talk) 01:06, 26 April 2022 (UTC)
Partly. The problem seems to be that some of the citations use just name="Artnews" but others use name="Artnews" group="". The name isn't being changed when it appears with group="". Pinging Sophivorus. Certes (talk) 09:59, 26 April 2022 (UTC)
I must be missing something; all the usage I see is <ref name="Artnews"/>, without a group name attribute (not even a blank one). -- Mikeblas (talk) 13:50, 26 April 2022 (UTC)
No, I was missing something. I put {{excerpt|List of national pavilions at the 59th Venice Biennale|National pavilions}} through Special:ExpandTemplates and noted that some ref tags had group="" and didn't get a prefix. I hadn't spotted that they were expansions of {{r}} in the original article. That no longer happens now that the article contains a workaround. Certes (talk) 14:44, 26 April 2022 (UTC)
Observation: it seems to work fine when it came across more named references, such as <ref name="Artnews"/>, but fails when it is trying to call the reference via {{r|...}} on the remote article. I replaced one instance of r with the declaration and the problem went away. For your immediate need @Mikeblas: you could do the rest of those, as in Special:Diff/1084771632. — xaosflux Talk 14:05, 26 April 2022 (UTC)
That works! Sorry, I thought I had already removed uses of the {{r}} tempplate -- except for the invocations which were commented away. So it looks like the problem is that {{excerpt}} is simply incompatible with {{r}}. -- Mikeblas (talk) 14:10, 26 April 2022 (UTC)

Template-protected edit request on 17 May 2022 - Rare section edge-cases

Note: This is actually a dual edit request, with the pages in question being both Module:Excerpt and Module:Transcluder. Im only going to do 1 edit request to avoid polluting anything.

This is a potential fix for the transcluder and excerpt not correctly recognising a section's name if it contained a #. Note that while the testcases for excerpt have shown this change should be perfectly fine, I would preferably like a comment from anyone who knows more about this module than me to mention if there was a reason for ([^#]*) over (.*) (if any) before a TE or other implements this, as it feels odd enough to potentially be intentional.

The relevant fixes are on the sandbox for each page. The main excerpt testcases can be found here and the examples of it successfully working with the # are visible on my test page. Note that /testcases3 is claiming that there are differences between the 2 versions on some examples. After using safesubst to get the exact content and using a comparison tool, no difference was noted. Im not entirely sure what has happened there.

Thanks. Aidan9382 (talk) 21:17, 17 May 2022 (UTC)

@Aidan9382 Done, thanks for the fix and careful request! BTW, the issue with /testcases3 has been there for a long time and seems caused by Template:Test case table Sophivorus (talk) 21:15, 18 May 2022 (UTC)
Thanks for implementing! That testcases bug feels very odd to be happening, but thanks for letting me know. Might take a look at it, who knows. Aidan9382 (talk) 04:31, 19 May 2022 (UTC)
@Sophivorus: Thanks for bringing that whole /testcases3 issue has been happening for a while thing. Been working on that module for the past hour or so, and it really needs some slight bug fixing. The UNIQ--QINU detection was the issue here (fixed now), but the nowiki and nowiki+ output options are apparently not doing so good and making the diff checker think this isnt right (Maybe its somehow skipping normalisation?), so i guess ive got something to focus on now. Aidan9382 (talk) 05:32, 19 May 2022 (UTC)
@Aidan9382 Awesome, I didn't know you were working on that module! The testcases look green already, so thanks, nice work! Sophivorus (talk) 11:26, 19 May 2022 (UTC)

Template-protected edit request on 29 May 2022 - Blacklist fix

In the /config, protection padlock (pp) templates are considered blacklisted. However, the current regex, [Pp]p%-.+, catches all protection templates except the core {{pp}} one. To fix this, change

'[Pp]p%-.+',  -- {{pp-move-indef}} etc.

to

'[Pp]p', '[Pp]p%-.+',  -- {{pp-move-indef}} etc.

The reason its over 2 different regexs is because simply doing [Pp]p.* might be a bit too aggressive, and its easier to stay on the safe side of things. Thanks. Aidan9382 (talk) 21:18, 29 May 2022 (UTC)

  Done. P.I. Ellsworth , ed. put'r there 00:18, 30 May 2022 (UTC)

Recent change?

Has there been a recent change to the module - I'm noticing pages that previously worked are once again getting the error "The time allocated for running scripts has expired" --Find bruce (talk) 22:52, 28 May 2022 (UTC)

Always link to an example page when you are reporting a possible problem. – Jonesey95 (talk) 23:50, 28 May 2022 (UTC)
Thanks for the reminder. An example is Electoral results for the district of Bathurst, but the problem exists in virtually every article in Category:New South Wales state electoral results by district. You will note that every election prior to 1930 uses transcluded sections rather than the template. This was done in December 2021 [1] to deal with the error. Find bruce (talk) 02:21, 29 May 2022 (UTC)
@Find bruce: This issue has existed for a while - ive noticed quite a few election articles that have had this error for a while. As for recent changes, no. This module and its main associated module (Module:Transcluder) have had no significant changes that would affect performance. Pages can just sometimes take longer or shorter to load each time you save a page with Excerpt. Hope this helps. Aidan9382 (talk) 03:58, 29 May 2022 (UTC)
Thanks @Aidan9382: - the issue never arose when I first started using the module in June 2020 & first appeared around August last year. I edited all 350 articles to implement a work around. I will wait to see if anyone has a solution, otherwise I will simply give up on the module & go back to my previous template approach for all but the most recent elections - it's not as elegant & there are traps for the unwary that the module avoids, but it works with fewer resources. Find bruce (talk) 05:48, 29 May 2022 (UTC)
@Find bruce: There seem to have been quiet a few changes to the Transcluder last year august, but I don't see any differences that could be major. If your having to implement a fix for 350 pages, then I think it might be time this module set had a performance look-over, as that could cause a bit of confusion for passing editors. I'll take a look, see if I can find any performance improvements, but for now, I guess the template approach will have to do. Aidan9382 (talk) 05:59, 29 May 2022 (UTC)

@Find bruce: - Just came across an interesting discovery. It turns out that one of the main expensive calls (as in a third of the entire lua runtime) is to do with it trying its hardest to find files. Of course, in this situation, files are not gonna be relevant (at least I doubt it). Adding |files=0 to all the excerpts on a page should significantly improve the performance, and infact should be good enough to remove lua timeout errors in 99% (or 100% if we are lucky enough) of scenarios. Give it a shot, tell me how it goes. Aidan9382 (talk) 07:45, 29 May 2022 (UTC)

I haven't investigated the current code but it may be worth looking at Transcluder.removeNonFreeFiles(). A previous version of the module (now forked for use in portals) spent a lot of its time opening every file's rationale to check whether it could be included, and there was no obvious way to do that more efficiently. Certes (talk) 18:28, 29 May 2022 (UTC)
@Certes: While I could easily see that becoming a quick problem (just the sound of it makes me concerned), that unfortunately isn't the issue here. Transcluder.removeNonFreeFiles is only ran if any files are found. The issue here is the fact its going to extents much further than whats worth it to attempt to find files unless explicity told not to, and that is leading to another expensive Transcluder.get call. I will note that there may be reason for concern, as I've just noticed the code only attempts to remove Non-free files if found in blacklisted templates (Not a common scenario. I can explain further if required). Do you think this is worth looking into as another potential issue with this module? Thanks! Aidan9382 (talk) 18:36, 29 May 2022 (UTC)
@Aidan9382: I think the "blacklisting" is just another way to specify files, e.g. files=-2 means all files except the second, and behaves just like files=1,3-999. The check looks unchanged from the portal version except that it's also checking Commons, which may be unnecessary as Commons doesn't accept non-free content. It would be nice if we had an inexpensive isFileNonFree method, but sadly we do need to read the text; people got very upset and started deleting transclusions when we didn't. However, as you say, this may be a red herring as that code only runs when a file is found. Certes (talk) 19:38, 29 May 2022 (UTC)
Thanks @Aidan9382: I have added |files=0 to all the excerpts in Category:New South Wales state electoral results by district & it appears to have fixed all of the current timeout issues. Find bruce (talk) 08:56, 30 May 2022 (UTC)

Expensive calls and why excerpt runs so slow

During some recent testing, I was giving a prod at some of the parts of excerpt, and I noticed a section to do with desperately trying to grab files from anything we might have missed if a file cant be found initially (Lines 152-173). After excluding the content during some testing and some show preview usage, I noticed the execution time dropped by about 42% (Average 7.4438s -> Average 4.304s). As expected, the actually troubling part of that is probably the second Transcluder.get() for just templates. However, I am running very short on solutions, so I was wondering: Could someone give their opinions on:

  • The usefulness of having this to run by default,
  • The usefulness of this code section in general (why only try if we couldnt get files normally? Why does this make the infobox invaluable?), and
  • Any solutions that could either prevent calling it too often or improve the calling of it

I have a solution idea in mind, however the elegance of it is very low and is quite a hacky idea that would probably be a bad move, so input from others would be nice. Aidan9382 (talk) 18:26, 29 May 2022 (UTC)

@Aidan9382 Amazing find!! The usefulness of the feature is basically that many articles (perhaps even most) have their main image in the infobox, so this code tries to salvage it. It's inefficient, messy and even unreliable, I agree, but also useful and perhaps even expected at this point. That being said, I think I have an idea on how to fix it! I tried to implement it here but I couldn't quite finish (it's late and I can't find a good way to debug!). Basically the idea is to avoid entirely the second call to get() which essentially fires a second request and is probably the main cause of the performance loss. @Certes The call to removeNonFreeFiles also fires a request and may be causing a performance loss, so I'm thinking that given that all the trouble you had was in portals, we can maybe disable this feature on the mainspace by default, and only enable it on a case-by-case basis when required, thus avoiding the performance loss. Sounds like a plan? Sophivorus (talk) 21:26, 30 May 2022 (UTC)
@Sophivorus: Disabling the check in mainspace is worth a try. We need the current behaviour (in Module:Excerpt/portals, not Module:Excerpt) for portals because many of them display an excerpt from one article picked randomly from a long list, and no one checks them all to see if one has a blurry movie still that will bankrupt Hollywood if displayed. Certes (talk) 21:38, 30 May 2022 (UTC)
@Aidan9382 @Certes I think I nailed it (see Module:Excerpt/sandbox). I still have to fix a few minor issues, but would you mind checking if the effort was worth it, Aidan9382? (I have no idea know how to benchmark Lua modules.) Thanks! Sophivorus (talk) 23:23, 30 May 2022 (UTC)
@Sophivorus: I don't know the current code well enough to review it properly but that change to checking freefiles looks like what you need. (I'm interpreting that flag as "limit to free files only?".) For a quick benchmark, I preview with a relevant page, view the source code (Ctrl-U on Firefox) and search for "NewPP limit report". That shows how close we are to various limits (rarely a problem except in portals) and gives timings for various templates and Lua functions. Certes (talk) 23:36, 30 May 2022 (UTC)
@Certes Awesome! Well, judging by the "NewPP limit report" for Electoral results for the district of Bathurst it seems the sandbox version is far superior (~ 6 secs vs ~10 secs)! I'll wait for Aidan while I fix the remaining issues and deploy in a day or two, cheers!! Sophivorus (talk) 00:12, 31 May 2022 (UTC)
@Sophivorus: I've gone ahead and done some comparisons between Except and Excerpt/sandbox on a test page, and I can confirm the /sandbox version fixes the issue quite well, bringing my test page from an average of 8s to an average of 6s (The results are being really inconsistent so the improve is probably better than 1/4th). My only concern with doing Transcluder.getTemplates(excerpt) is that, if the excerpt is set to only=files (or similar), the excerpt will include no templates, and therefore wont find any infoboxes, but this is more of a rare scenario. While you could technically grab an unfiltered excerpt of the section and filter out what the user wants later, that also kinda nullifies a significant part of Transcluder's get(), so I'm wary of trying to implement that. Other than that though, this looks like its doing a fine job. Nice work! Aidan9382 (talk) 05:06, 31 May 2022 (UTC)
My theory seems to be correct, but it also seems to not be removing non-free files. Just take a look at the differences from Template:Excerpt/testcases. Also check Template:Excerpt/testcases2 for a weird template difference at the bottom. Note: If the content side by side looks the same, but its marked as different (yellow, uncollapsed), then its a formatting difference. Ignore it, consider it the same. It probably is. Aidan9382 (talk) 13:23, 31 May 2022 (UTC)
@Aidan9382 Thanks for the insights! I was able to fix the issue at the bottom of /testcases2, here. As to the non-free files, as I mentioned to Certes above, it's just a change in the defaults. From here on non-free files will have to be filtered explicitly by setting freefiles=yes. This is because 99% of excerpts don't have issues with non-free files but each check for non-free files is expensive. Finally, regarding the issue in /testcases where only=files no longer gets files from the infobox, I agree this is an edge case not worth the trouble. If no more issues or concerns arise, I'll deploy in a day or two, cheers! Sophivorus (talk) 22:38, 31 May 2022 (UTC)
@Aidan9382 @Certes Deployed! I'll stay around for some minutes just in case, thanks for the awesome work and support! @Find bruce This new version should make setting files=0 unnecessary. Thanks for bringing up this issue in the first place! Sophivorus (talk) 22:07, 1 June 2022 (UTC)

Underscore ref name bug

Agriculture in California is using an excerpt of California wine which produces Cite error: The named reference California wine Misson_Grape was invoked but never defined (see the help page). Examination of the resulting HTML suggests excerpt does not understand _. Invasive Spices (talk) 2 June 2022 (UTC)

Ah, this isn't an issue due to the underscore. This error is because the reference is defined in the infobox (| wine years = {{years ago|1769}}<ref name="Misson_Grape">{{cite web| url=https://www.wine-blog.org/index.php/2011/03/17/the-mission-grape-played-a-major-role-in-california-wine-viticultural-history/ | title=The Mission Grape Played a Major Role in California Wine Viticultural History | author1=Diaz, Jo |website=Wine Blog | date=2011-03-17}}</ref>), and is only a short named reference in the text that was actually excerpted (<ref name="Misson_Grape"/>). For a solution, I'd recommend defining it in the text and keeping it as a short named reference in the infobox. Aidan9382 (talk) 15:57, 2 June 2022 (UTC)
I've implemented the fix, so don't worry about it. Aidan9382 (talk) 16:03, 2 June 2022 (UTC)

Appears to exclude template

Excerpt appears to be excluding {{Election box 2pp}} and I'm not sure why. The template adds a row "Two-party-preferred result" to the election results table - see for example Results of the 2022 Australian federal election in Victoria#Aston which is excerpted to Electoral results for the Division of Aston#2022, where everything but that template. I tried setting templates=.* however that then excerpted only that template & nothing else --Find bruce (talk) 05:05, 4 June 2022 (UTC)

Huh, thats odd. I don't immediately see it in the template blacklist. I'll get looking into it in a short moment. Aidan9382 (talk) 05:08, 4 June 2022 (UTC)
@Find bruce: Thanks for the notice - this seems to be a potential bug with the module. I'll go ahead and look into a fix. For now, just dont worry about getting the 2pp in - I don't see a hacky workaround here. Aidan9382 (talk) 05:23, 4 June 2022 (UTC)

@Sophivorus: (or others) I've implemented a fix for the situation above (It's an issue with how the blacklisting / whitelisting is done and how either its all blacklist or no blacklist, which is a bit inconvenient) that should mean |templates= now correctly overwrites the blacklist. However, I've done this in a way that, in my opinion, might be a bit too off brand, and I'd like input from someone else before submitting an edit request to get this fixed. (This involves a change to both Module:Excerpt/sandbox and Module:Transcluder/sandbox). Opinions? Aidan9382 (talk) 05:59, 4 June 2022 (UTC)

@Aidan9382: We discussed some ideas in #Short description being transcluded above. Certes (talk) 09:35, 4 June 2022 (UTC)
@Certes: Thanks, I missed that. From reading, it seems a decent solution here would be to simply append the "templates" parameter to the default blacklist if it starts with hyphen (-) and replace it if it doesn't. After all, I can't recall of any actual cases where someone wanted to "exclude templates X and Y but include the ones in the blacklist". Do you? It's always "exclude templates X and Y as well as those in the blacklist". I'll try recreate this on the sandbox and see how it functions. If it fixes the idea, I'd be much happier to put that up for an edit request. Aidan9382 (talk) 09:43, 4 June 2022 (UTC)
@Certes: Not only was that super simple to implement, but it seems to have worked fine, and should still follow what Template:Excerpt says for the expected functionallity. If that looks all good to you, I'll put up a TE edit request. Aidan9382 (talk) 09:48, 4 June 2022 (UTC)
@Aidan9382: That looks good to me and even works with the edge case List of United States tornadoes in 1950, but best for Sophivorus to have a quick look at it before it goes live. Certes (talk) 09:57, 4 June 2022 (UTC)
Alright, cool. May I ask, what was the edge case at Tornadoes 1950? Oh and, please reply with direct source - I have no idea whats going on, but Bawl! is freaking out and replacing the previous section with a duplicate (Just see your edit diff in history and itll make sense). Aidan9382 (talk) 10:00, 4 June 2022 (UTC)
Not sure what went on with Bawl there, but thanks for fixing. Tornadoes now uses |templates=.* but had previously used |templates=-Coords to include all templates except Coords (a template not used here, not to be confused with Coord which is used and is included). Certes (talk) 10:09, 4 June 2022 (UTC)
Certes, Aidan9382, a few things happened. When you add a comment, you really do a section edit. Obtain the original text for the section, insert comment into text, perform section edit with new section text. Bawl edited the wrong section: section 20 instead of 21, so the previous section was overwritten with the text of this section plus your comment. This was an odd combination of circumstances. There are several ways to get the right section number: either just take it from the section edit link, search for the section title or.. the other way. When the section number is taken from the section edit link, it'll break if archiverbot passes by while you are reading or if someone adds a subsection in a section above the one you're commenting on. That issue affects all editors. Well, all but Bawl.
Bawl uses the section title when editing a whole section because there isn't much else. (a section could be empty after all) The section #Cite error: Invalid <ref> tag uses nowiki tags in the title. As Bawl can only get the section title from the HTML, any codes can cause issues. To some degree this gets compensated, wikilinks in a title for example are no problem. Nowiki on the other hand.. Using &lt;ref&gt; should work better, but that section can't be edited as a section currently. Should work now too.
But when commenting it actually follows a different strategy. It becomes completely agnostic towards the section title. Section title changed while your were reading? No problem. Bawl determines the section number itself. In this process, various elements are escaped to avoid counting "sections" that are actually code examples or otherwise not actually sections. That ref tag above was an issue as it was seen as an unclosed ref tag. Another issue is found in #Template-protected edit request on 3 March 2022 where within pre tags two opening code tags are found. The second one was meant to be a closing code tag and neither of them work because they are within pre tags. Assuming I won't duplicate this section, I fixed this issue: Bawl now escapes pre and nowiki first as those could legitimately contain unbalanced tags which would otherwise throw off the escape process. Alexis Jazz (talk or ping me) 12:50, 4 June 2022 (UTC)
@Aidan9382 Deployed! Awesome work, thanks! @Alexis Jazz Not sure what this Bawl thing is about, but let me know if you require my input. Cheers! Sophivorus (talk) 13:45, 5 June 2022 (UTC)
@Sophivorus: Dont worry about the Bawl stuff - its something Certes uses in conversation and it had a bit of a bug during our conversation.
Courtesy ping to Find bruce who started this conversation - bug is fixed! Aidan9382 (talk) 14:39, 5 June 2022 (UTC)
Thanks @Aidan9382. Sadly however Electoral results for the Division of Aston#2022 remains broken Find bruce (talk) 21:39, 5 June 2022 (UTC)
@Find bruce: Ah sorry, should've been clear. Theres been no change to the blacklist (I don't even know what from the blacklist is against 2pp, but I have an idea), but it has fixed the |templates= parameter, so you can get around the blacklist should it be a bit odd. I've fixed it as needed. Aidan9382 (talk) 04:56, 6 June 2022 (UTC)

Thanks for clarifying @Aidan9382. The issue affects nearly half of the 2,659 Articles with excerpts, so I'm not keen on running an AWB script to add a workaround. By way of background almost every Australian election result uses 2pp. These results used to be duplicated or triplicated & so to reduce editing effort and inconsistency I have encouraged editors to have the result table at one place and excerpt it to the other articles, eg the 2022 election for Aston is at Results of the 2022 Australian federal election in Victoria#Aston and excerpted at Electoral results for the Division of Aston#2022 and Division of Aston. The module has been so useful & so well accepted that other editors have gratefully adopted using it. I will post a note on the Australian politics project page, which should give enough time to fix the blacklist. Find bruce (talk) 05:27, 6 June 2022 (UTC)

@Find bruce: I see. In that case, I do believe I know what the potential issue is with the blacklist, and I'll do a hopeful edit request now. Hopefully it'll fix, but I'll just need to look at the code for a short moment to confirm my theory. Thanks for the notice! Aidan9382 (talk) 05:30, 6 June 2022 (UTC)

Template-protected edit request on 6 June 2022 - Blacklist fix

Within the blacklist, [Pp]p needs to be changed to ^[Pp]p so that its explicit this should only be matched if at the start. Also note that this means that all the entires with .* in their regex at the end or beginning can have it removed, as it is functionless in this scenario. Aidan9382 (talk) 05:33, 6 June 2022 (UTC)

  Done. P.I. Ellsworth , ed. put'r there 08:09, 6 June 2022 (UTC)
@Find bruce: Core issue fixed. Look all good now? Aidan9382 (talk) 08:14, 6 June 2022 (UTC)
Looks good, thanks for your help @Aidan9382. I really appreciate Sophivorus' work in developing this and the assistance from yourself and Certes in maintaining & improving it - I owe you all a beer if you're in Sydney to collect. Cheers Find bruce (talk) 09:54, 6 June 2022 (UTC)

Template-protected edit request on 11 June 2022 - Blacklist optimisation

Hey. I was recently looking at the section related to -- {{More citations needed}} and its many aliases and noticed quite a lot of the Regexs are repetitive, and that the list could easily be reduced quite far with a few changes. I have posted my changes to the /sandbox, and you can see the difference there.

Couple of important points: There are a lot of specific exclusions to do with reference templates (E.g. '[Ii]mprove[ -]?references?'), but they all get overshadowed by '[Rr]eferences?'. Thats part of the reason so many of the regexs have dissapeared from the list.

If you are confused about a specific removal or optimisation of mine, feel free to ask. It should be functionally equivilant to the previous. It can still be improved much further, but its a bit messy to navigate, and I don't want to go too far and accidentally screw up the blacklist, as this already feels a bit unstable. I have tested this by putting it into the config/sandbox and checking the /testcases, all looks good as far as I can see. Aidan9382 (talk) 19:25, 11 June 2022 (UTC)

@Aidan9382 Deployed! I trust your judgement and the test cases look good. If any unwanted template gets through (or the other way round) we can always fix it on demand. Cheers! Sophivorus (talk) 23:11, 11 June 2022 (UTC)

The fragment parameter does not seem to work

@Sophivorus: see Module:Excerpt/testcases#Fragments

Instead of displaying the specified paragraph of women in philosophy, it displays the entire introductory section

--Yinyue200 (talk) 01:37, 15 June 2022 (UTC)

@Yinyue200 The issue was that "fragment" has become a local alias of the 2nd parameter (see here), so I simply updated the testcases to reflect that (diff). Thanks for the report! Sophivorus (talk) 11:54, 15 June 2022 (UTC)

Further optimisation of the blacklist

Hey! I was recently working on a script to compare and find redundant regexs (see this for the background of it) and I discovered that a lot of regexs in the blacklist are rendered useless by others. The exact list (once manually filtered of false positives, though some may be left in there) looks like this:

List of regexs
[Tt]his article is about is inferior to [Aa]bout
[Tt]his article is about is inferior to [Tt]his
[Cc]ampaignbox is inferior to [Cc]ampaign
[Ll]ocation dec is inferior to [Ll]ocation
[Ff]eatured ?article is inferior to [Ff]eatured
[Ff]eaturedSmall is inferior to [Ff]eatured
FA topicon is inferior to [Tt]opic
[Ll]ead ?missing is inferior to [Ll]ead
[Ll]ede missing is inferior to [Ll]ede
[Nn]ointroduction is inferior to [Nn]o[ -]?[Ii]ntro
[Nn]o[ -]?[Ii]ntro is inferior to [Ii]ntro
[Nn]ointroduction is inferior to [Ii]ntro
[Nn]o ?lead ?section is inferior to [Nn]o[ -]?lead
[Nn]o[ -]?lead is inferior to [Ll]ead
[Nn]o ?lede is inferior to [Ll]ede
[Mm]issingintro is inferior to [Ii]ntro
[Ii]ntro[ -]?missing is inferior to [Ii]ntro
[Nn]o ?lead ?section is inferior to [Ll]ead ?section
[Nn]o ?lead ?section is inferior to [Ll]ead
[Mm]issing lead is inferior to [Ll]ead
[Mm]issing lede is inferior to [Ll]ede
[Ll]ead absent is inferior to [Ll]ead
[Ll]ede absent is inferior to [Ll]ede
[Ii]ntroduction needed is inferior to [Ii]ntro
[Ii]ntroduction missing is inferior to [Ii]ntro
[Ii]ntro needed is inferior to [Ii]ntro
[Ll]ead required is inferior to [Ll]ead
[Ll]ede required is inferior to [Ll]ede
[Ll]ead too long is inferior to [Ll]ead
[Ll]ead too long is inferior to [Ll]ong
[Ll]ead too long is inferior to [Tt]oo[ -]?[Ll]ong
[Ll]ede ?too ?long is inferior to [Ll]ede
[Ll]ede ?too ?long is inferior to [Ll]ong
[Ll]ede ?too ?long is inferior to [Tt]oo[ -]?[Ll]ong
[Ii]ntro ?length is inferior to [Ii]ntro
[Ll]ongintro is inferior to [Ii]ntro
[Ll]ongintro is inferior to [Ll]ong
[Ll]ong ?lead is inferior to [Ll]ead
[Ll]ong ?lead is inferior to [Ll]ong
[Ll]ong ?lede is inferior to [Ll]ede
[Ll]ong ?lede is inferior to [Ll]ong
[Ii]ntro[ -]?too[ -]?long is inferior to [Ii]ntro
[Ii]ntro[ -]?too[ -]?long is inferior to [Ll]ong
[Ii]ntro[ -]?too[ -]?long is inferior to [Tt]oo[ -]?[Ll]ong
[Ll]ead long is inferior to [Ll]ead
[Ll]ead long is inferior to [Ll]ong
[Ll]ead[ -]?rewrite is inferior to [Ll]ead
[Ll]ead ?section is inferior to [Ll]ead
[Vv]agueintro is inferior to [Ii]ntro
[Cc]leanup-lead is inferior to [Ll]ead
[Ii]ntro-?rewrite is inferior to [Ii]ntro
[Ss]hort ?intro is inferior to [Ii]ntro
[Ii]ntro[ -]?too[ -]?short is inferior to [Ii]ntro
[Ii]ntro-expand is inferior to [Ii]ntro
[Rr]ewrite lead is inferior to [Ll]ead
[Cc]leanup lead is inferior to [Ll]ead
[Ll]ead[ -]?too[ -]?short is inferior to [Ll]ead
[Ee]xpand ?lead is inferior to [Ll]ead
[Ss]hort ?lead is inferior to [Ll]ead
[Bb]uild lead is inferior to [Ll]ead
[Ll]ede rewrite is inferior to [Ll]ede
[Ll]ede[ -]?too[ -]?short is inferior to [Ll]ede
[Ee]xpand ?lede is inferior to [Ll]ede
[Mm]ain ?[Aa]rticles? is inferior to [Mm]ain[12]?
[Mm]ain page is inferior to [Mm]ain[12]?
[Ss]ee ?main is inferior to [Mm]ain[12]?
[Rr]eadmain is inferior to [Mm]ain[12]?
[Hh]urricane main is inferior to [Mm]ain[12]?
[Nn]avigation ?[Bb]ox is inferior to [Nn]avigation
[Nn]avigation Template is inferior to [Nn]avigation
[Cc]?VG [Nn]avigation is inferior to [Nn]avigation
[Oo]ther ?[Uu]ses?[13]? is inferior to [Oo]thers?
[Ff]or other uses is inferior to [Oo]ther ?[Uu]ses?[13]?
[Oo]ther ?[Mm]eanings? is inferior to [Oo]thers?
[Oo]thervalues is inferior to [Oo]thers?
[Ff]or other uses is inferior to [Oo]thers?
[Ss]ee other is inferior to [Oo]thers?
[Rr]edirect is inferior to [Rr][Ee]dir
[Ss]ee ?[Aa]lso is inferior to [Aa]lso
[Ss]ee-[Aa]lso is inferior to [Aa]lso
[Ll]ooking for is inferior to [Ll]ooking
[Bb]rief description is inferior to [Dd]escription
[Dd]escription is inferior to [Rr]ip
[Bb]rief description is inferior to [Rr]ip
[Ff]urther2 is inferior to [Ff]urther
[Vv]ery ?long is inferior to [Ll]ong
[Ll]ongish is inferior to [Ll]ong
[Tt]oo[ -]?[Ll]ong is inferior to [Ll]ong
2long is inferior to [Ll]ong
2long is inferior to 2[Ll]
[Cc]ite ?[Ss]ources? is inferior to [Ss]ources?
[Cc]leanup[ -]?[Vv]erify is inferior to [Vv]erify
[Ff]ew ?sources? is inferior to [Ss]ources?
[Ii]mprove[ -]?sources? is inferior to [Ss]ources?
[Mm]ore ?[Ss]ources? is inferior to [Ss]ources?
[Nn]o ?sources is inferior to [Ss]ources?
[Rr]eference improve is inferior to [Rr]eferences?
[Rr]eferenced is inferior to [Rr]eferences?
[Uu]nderreferenced is inferior to [Rr]eferences?
[Uu]nderreferenced is inferior to [Rr]eferenced
[Uu]nsourced is inferior to [Ss]ources?
[Nn]POV is inferior to POV
[Nn]POV Check is inferior to POV
[Nn]POV check is inferior to POV
[Nn]POV-dispute is inferior to POV
[Nn]pov is inferior to [Pp]ov
[Nn]POV check is inferior to [Pp]OV check
[Pp]ov check is inferior to [Pp]ov
[Pp]ov-Check is inferior to [Pp]ov
[Pp]ov-check is inferior to [Pp]ov
[Pp]ovcheck is inferior to [Pp]ov
[Pp]ov Check is inferior to [Pp]ov
[Pp]ov-check-section is inferior to [Pp]ov
[Pp]ov problem is inferior to [Pp]ov
[Nn]POV Check is inferior to [Nn]POV
[Nn]POV check is inferior to [Nn]POV
[Nn]POV-dispute is inferior to [Nn]POV
[Nn]eutrality is inferior to [Nn]eutral
[Pp]OV-check-section is inferior to [Pp]OV-check
[Nn]POV Check is inferior to [Pp]OV Check
[Pp]ov-check-section is inferior to [Pp]ov-check
[Nn]PoV is inferior to [Pp]oV
[Nn]ot neutral is inferior to [Nn]eutral

I'm wondering - is it worth it to correct these? While I wouldn't be surprised if the module ran somewhat faster if these were removed, I do think at least some of these should be potentially kept for the clarity of other editors, though I'm unsure. I would definitely say some of them are much more worrying (E.g. the 4 different version of pov check that could easily be covered by just [Pp]ov[ -][Cc]heck) but some of them are more reasonable. Any comments on this? (If wanted for comparison, I can force the script to give an output of what the cleaned version would look like). Aidan9382 (talk) 22:04, 26 June 2022 (UTC)

@Aidan9382 Awesome work! I do agree that keeping the list human-readable is important. After all, machines should work harder for us, not the other way round heh. That considered, if you want to trim the blacklist based on your work, I'll be happy to deploy it immediately. Sophivorus (talk) 13:49, 27 June 2022 (UTC)

Circumventing loops

Hey! I recently just came across a situation in which an excerpt of a section had an excerpt of its own, leading to the dreaded template loop error. I was wondering - would there be any (reasonable) way to circumvent this? If the excerpt isnt required, just doing templates=-Excerpt does a good job (as I've done here), but I was wondering, what if the nested excerpt was integral? Unfortunately, I don't believe this is an issue that can (or maybe even should) be rectified, however I felt I'd mention it anyways incase someone had a comment or "workaround" on the subject. Aidan9382 (talk) 18:41, 23 June 2022 (UTC)

templates=-Excerpt looks like the way to go. It's a similar situation to Template:Foo calling {{Bar}} whilst Template:Bar calls {{Foo}}, which is avoided only by the loop error check. Certes (talk) 19:10, 23 June 2022 (UTC)
Perhaps Template:Excerpt itself should be added to the blacklist? I don't fancy these double-excerpts since they make things unnecessarily complicated to understand. Sophivorus (talk) 13:54, 27 June 2022 (UTC)

Template-protected edit request on 22 June 2022

Could '[Aa]nchor' be added to the blacklist config? It shouldnt be transcluded on pages by default as, seen above, it can break regular anchors in the text. Aidan9382 (talk) 21:21, 22 June 2022 (UTC)

Done! Sophivorus (talk) 13:55, 27 June 2022 (UTC)

Anchors shouldn't be incorporated

In Agriculture in California something is adding anchors for #Pests and #Diseases before #Cherries. I think this is the preceding {{Excerpt}} incorporating the {{anchor|Pests|Diseases}} in Cannabis in California. I think these are the only anchors it copies to Agriculture in California because there are no other anchors in Cannabis in California merely normal section headers.

This is a more serious problem than it appears because there are identical legitimate section names in Agriculture in California and these sections are the targets of redirects – Pests in California and Agricultural diseases in California. Invasive Spices (talk) 22 June 2022 (UTC)

@Invasive Spices: Hey! Thanks for the report. Looking at this, yeah, I'm not entirely sure why anchors have been included, as they do seem to break the flow of some pages. Ive opened a relevant edit request below that should fix your problem. Hope this helps. Aidan9382 (talk) 21:21, 22 June 2022 (UTC)
@Aidan9382 @Invasive Spices Should be fixed now! Can you confirm? Sophivorus (talk) 13:53, 27 June 2022 (UTC)
Can confirm this has worked. Thanks for implementing it. Aidan9382 (talk) 15:03, 27 June 2022 (UTC)
Confirm. Agricultural pests in California works now and Cannabis in California#Pests has not changed. Thank you for fixing this. Invasive Spices (talk) 27 June 2022 (UTC)

Template-protected edit request on 27 June 2022 - More blacklist changes

More optimisations of the blacklist. Mostly merging / removal of duplicate or similar regexs within the blacklist. Very few minor changes to the actual scopes of the regexs. All changes are visible on the sandbox. My edits have been done in parts so that you may scrutinise specific changes to it if required. Aidan9382 (talk) 20:45, 27 June 2022 (UTC)

  Done. P.I. Ellsworth , ed. put'r there 06:58, 28 June 2022 (UTC)

Possible bug with multi-section editing when excerpting multiple sections

This module is very useful, but I noticed something whenever an editor tries to excerpt multiple sections. Particularly, in MetroCard#Fares is an excerpt of the entirety of New York City transit fares#Current fares. If someone tries to edit one of the excerpted subsections like MetroCard#Fare media, the module will attempt to direct the user to edit the code of Module:Excerpt. I say "attempt" because the user will instead get an error message that section editing is not supported and/or that the user cannot edit the page because they aren't a template editor. This is a minor issue, though, and can probably be resolved by either correcting the edit links for excerpted sections, or by disabling section editing entirely when multiple sections are excerpted. – Epicgenius (talk) 23:40, 3 July 2022 (UTC)

Misnested tag lint error with file=yes

James Lovelock showed up in Lint errors: Misnested tag with different rendering in HTML5 and HTML4 (article namespace). The cause turned out to be

{{Excerpt|Gaia hypothesis|only=file|inline=yes}}

which has 2 pairs of HTML5-misnested and missing end tags for <span>...</span>. I tried

{{Excerpt|Gaia hypothesis|only=file|inline=no}}

which fixed the lint errors, but added unwanted display. So I went to What links to Template:Excerpt and edited each such page, one after the other, until I found one with

{{Excerpt|...|only=file...}}

or

{{Excerpt|...|only=files...}}

and the first one turned out to be Coal, which includes

{{Excerpt|Coal Pollution Mitigation|only=files|hat=no}}

which turns out not to have lint errors. So I tried

{{Excerpt|Gaia hypothesis|only=file|hat=no}}

and that seemed to give the same display as before (but without lint errors) and, for what it's worth,

{{Excerpt|Coal Pollution Mitigation|only=files|inline=no}}

does have the 2 pairs of lint errors.

If the template is working correctly, the documentation needs to explain what combinations of parameters to use or not use. More likely, the template needs to be modified so that {{Excerpt|...|only=file|inline=no}} and {{Excerpt|...|only=files|inline=no}} work, without generating lint errors. —Anomalocaris (talk) 06:46, 2 August 2022 (UTC)

Note to other editors: This issue seems to be originating from Lines 227/228. When inline is specified, the div tags used for the excerpt and excerpt-block classes are exchanged for span tags, and causes this mis-nesting. Unfortunately, I'm not familiar enough with HTML5/4 to know what a suitable fix is for this, so I shall leave this to another editor. Aidan9382 (talk) 09:40, 5 August 2022 (UTC)
@Anomalocaris @Aidan9382 Fixed, thanks for the report and research. It seems the problem was that block elements such as files cannot be nested inside inline elements such as spans, so I changed the spans for divs with display:inline set via CSS. Kind of hacky but does the job. I also changed inline=yes for hat=no in James Lovelock though. It seemed a more appropriate use of the parameters. Cheers! Sophivorus (talk) 12:53, 5 August 2022 (UTC)
Sophivorus: Thank you very much! —Anomalocaris (talk) 17:19, 5 August 2022 (UTC)
TPER disabled upon completion. P.I. Ellsworth , ed. put'r there 20:28, 5 August 2022 (UTC)

Alt text, captions not picking up from infoboxes

I was reviewing Wind power in Turkey for GAN and found that images that are brought into that page using {{excerpt}} and which are in infoboxes on transcluded pages, like Çanta Wind Farm, do not have their captions or alt text ported over in the transcluding page. What causes this, and how can it be remediated? Sammi Brie (she/her • tc) 08:17, 29 August 2022 (UTC)

@Sammi Brie Hi! The image caption of the infobox image should have been transcluded, I just fixed it, check out Wind power in Turkey#Çanta Wind Farm now. As to the alt text, I'm afraid that's not supported for now, but I just added it to my to-do list, cheers! Sophivorus (talk) 12:36, 29 August 2022 (UTC)

Reference error at Magic: The Gathering#Gameplay

Reference 10 is producing "Cite error: The named reference Magic: The Gathering rules :1 was invoked but never defined (see the help page).". The article being excepted from, Magic: The Gathering rules, does not have a cite error there, so excerpt must be failing to find the reference definition. * Pppery * it has begun... 01:28, 30 August 2022 (UTC)

I get to repay your two favors from earlier today. When the named ref is rendered in an article, the full ref needs to be present somewhere on the page. This means that if you excerpt a section in Article B from Article A that has a named ref in it, that full named ref either needs to exist in the excerpt from Article A or somewhere else in Article B.
On a related note, excerpting and transclusion is one of the many reasons that using auto-generated ref names like ":1" is a bad practice and should have been deprecated long ago; it means that if both Article A and Article B use the ref name ":1" but for different references, you could end up with WP:V problems or error messages. – Jonesey95 (talk) 02:22, 30 August 2022 (UTC)
I had thought one of this module's function's was to track down named reference definitions. I might have been mistaken. * Pppery * it has begun... 02:50, 30 August 2022‎ (UTC)
I'm pretty sure that's handled by prefixing the ref name with the article title. Something is going wrong in this case, possibly due to the colon in the article name clashing with the namespace delimiter. Sophivorus will know more. Certes (talk) 10:18, 30 August 2022 (UTC)
Indeed, this module prefixes the article title to the transcluded references to avoid conflicts (see here). It should also look for references outside the transcluded section. Not sure yet why it failed in this case... Sophivorus (talk) 17:23, 30 August 2022 (UTC)

Bug: bullet items outside the 'paragraphs' range are rendered anyway

I used {{excerpt|François Furet|French Revolution|paragraphs=3}} at Draft:French historiography#François Furet and got an unexpected result: it rendered paragraph three properly ("Furet then re-examined ... and the Commune of Paris in 1871.12 ") but then also rendered the four bullet items from paragraph 5, which should have been out of scope. I tried all sorts of workarounds (you can see some of them in these 10 tries) but with no success. Even replacing the bullets with {{bulleted list}} didn't work. What finally did it, was a kind of brute-force method: I added <noinclude>'s around the bullet items, but that of course means it will block anyone else trying to legitimately transclude paragraph 5, so not a very good workaround. Can someone look into what is causing this? Thanks, Mathglot (talk) 07:55, 23 September 2022 (UTC)

@Mathglot: Hey! I'm currently looking into this, so I'll see how it goes. In the mean time, you can use {{excerpt|François Furet|French Revolution|paragraphs=3|lists=0}} as a better workaround, as it disables the grabbing of the list without having to use noincludes. Aidan9382 (talk) 08:46, 23 September 2022 (UTC)
Quick followup: Judging from the code at Module:Transcluder#L-333, lists are, by design, not considered paragraphs, meaning that they are unaffected by the paragraphs parameter, meaning this behaviour is likely intentional. I don't work on this module too much, so I'll leave comments about this to other editors. Aidan9382 (talk) 09:04, 23 September 2022 (UTC)
A couple of things I noticed which are probably obvious, but it doesn't matter which paragraph you pull, unless you add the lists=0 parameter the bullet points get included in the excerpt. Also the bullet points are indeed not considered paragraphs by the excerpt module, because if you try to set it to paragraph=6 (which would be where the bullet points would be) it tells you the section is empty. - Aoidh (talk) 09:13, 23 September 2022 (UTC)
Okay, that seems a bit surprising , but if it's consensus that this is, indeed, the design, then I think this can be handled by careful additions/changes to the /doc page alone, probably with the addition of an example calling out a case very similar to this one. I did read the doc page top to bottom, and narrowly I suppose the doc page supports it, but I think I assumed that lists with a blank line before were their own paragraph, and ones without one were part of the preceding paragraph. In any case, I think a doc fix would be sufficient. Thank you very much, Aidan9382 and User:Aoidh for this helpful information, and let me know if this is definitely consensus or not, or if anything else needs to be checked/done. Cheers, Mathglot (talk) 17:05, 23 September 2022 (UTC)
I'm not entirely sure about the consensus, thats just the way it is right now. Could be worth proposing the change, since it does feel a little unintuitive with how completely disconnected lists are from paragraphs. Aidan9382 (talk) 18:21, 23 September 2022 (UTC)

When introducing an excerpt from AP Stylebook to Associated Press#AP Stylebook just now, it copied over the image, and looking into it, I see that the image is tagged as fair use. There's potential justification for having it at the AP article, too, but as a more general concern, this template should be identifying instances where fair use images are copied and not doing that by default. {{u|Sdkb}}talk 22:09, 23 September 2022 (UTC)

That's very odd: Module:Transcluder's removeNonFreeFiles() should find {{Non-free book cover}} within the description of File:AP stylebook cover.jpg and remove the image. Certes (talk) 22:37, 23 September 2022 (UTC)
Yeah, I seemed to remember that this had been considered before, so I guess there's some bug with this particular instance. {{u|Sdkb}}talk 22:48, 23 September 2022 (UTC)
Not sure if I'm misunderstanding here, but as far as im concerned, non-free files are just transcluded by default. If you want them removed, you need to specify |freefiles=yes, which should then fix your issue. Aidan9382 (talk) 05:54, 24 September 2022 (UTC)
That seems like definitely the wrong default. The non-free use justification that such files need to have is page specific, so in most cases it won't apply to other pages. {{u|Sdkb}}talk 05:57, 24 September 2022 (UTC)
I'll be honest, I thought they weren't transcluded by default in the first place either, but a look at the /doc and code showed it was. Would it be worth potentially switching the function of freefiles (having non-free files not transcluded by default but allowing the option)? Currently, only 8 articles use the freefiles parameter, so a major change wouldnt be too hard to fix, though im unsure of the impact on those that dont use freefiles. Aidan9382 (talk) 06:07, 24 September 2022 (UTC)
Sure, that sounds like an appropriate change to make. {{u|Sdkb}}talk 06:14, 24 September 2022 (UTC)
I'm not gonna try push any change myself, since I've learnt I can be comically stupid and I'd like input from others who know this module, but I've written a potential way of changing it to the sandbox for now. Feel free to change it however you want. Note that the documentation will need a minor adjustment to match this change if its implemented. Aidan9382 (talk) 06:33, 24 September 2022 (UTC)
The original Module:Excerpt (now forked as Module:Excerpt/portals) certainly removes non-free files – in fact, some portals spend significant time reading and parsing file descriptions to keep copyright holders happy. I incorrectly assumed that the current Module:Excerpt did so too, as it should unless there's a written rationale for showing each included file on the transcluding page. Certes (talk) 07:50, 24 September 2022 (UTC)
If I recall correctly, the default used to be remove non-free files by default. However, when trying to improve the performance of this module, I realized that checking for non-free files requires one additional web request per file, and because only a small percentage of the files are non-free, I changed the default to allow all files by default and have non-free files removed in a case-by-case basis. Sophivorus (talk) 12:55, 27 September 2022 (UTC)
Ah, yeah. I forgot about the performance implications. You are right - it was one of 2 changes done in this conversation to fix the fact that excerpt would run so slowly. However, I do think it may be worth re-implementing this behaviour despite that. While yes, most files may not have non-free use issues, most excerpts also dont end up transcluding files at all, so the impact this could have is probably not that extreme.
Also, I'd like to note that the current arg name (|freefiles=) does, in my opinion, sound a little confusing and unintuitive. Is it enabling the transclusion of free files (my first impression)? Does it mean we only transclude free files? What does it entail about default transclusion of free files? It might be worth reconsidering the name. Aidan9382 (talk) 13:06, 27 September 2022 (UTC)
Hmm it's hard to tell what's best. Lets wait for one more input shall we? As to renaming the parameter, I agree. Any suggestions? How about "removenonfreefiles"? A bit long and inconsistent with other parameters, but a bit clearer at least? Sophivorus (talk) 13:18, 27 September 2022 (UTC)
I've implemented a sort of mock test for swapping the behaviour at the sandbox, where I called it nonfreefiles (Intended to imply that this controls the inclusion of nonfreefiles, with a default of it not doing so). While I like how explicit removenonfreefiles is, it might be a bit too long for reasonable use. Perhaps onlyfreefiles would be better? Note that my mock one may also not work if we intend to include by default, so that decision may have to wait till we know what we wanna do with non-free files. Aidan9382 (talk) 13:31, 27 September 2022 (UTC)
How about checkfiles? If it's true, we check the files for freeness; if not, we don't. Certes (talk) 14:10, 27 September 2022 (UTC)
Both sound great! I think I like "onlyfreefiles" a bit more per being more explicit, though "checkfiles" is a bit shorter. But should we change the default to remove non free files by default, sacrificing performance? @Sdkb? Sophivorus (talk) 11:45, 28 September 2022 (UTC)
I decided to give the supposed performance impact a check, and the numbers are a bit interesting in my opinion. Using the current sandbox version and {{Excerpt/sandbox|AP Stylebook|nonfreefiles=(no/yes)}} as my benchmark, I found the performance difference to be somewhat minimal when the image is from an infobox (When not checking, average 2.1248 range 2.133 ±0.127. When checking, average 2.2065 range 2.2065 ±0.2555 not a calculation error, dw), and when it isnt from an infobox using U.S. News & World Report Best Colleges Ranking as the example article (When not checking, average 2.174 range 2.235 ±0.226. When checking, average 2.446 range 2.45 ±0.296). TL;DR: Disabling the check saves about 7.4% on the lua runtime, though it in reality may be less as my last test may have had a few outliers. If you're curious on the technical details, I based it off of 6 runs of "Show preview" and the report of the "Lua time usage", with the content of the page just being the same template call put ~32 times. It isn't a perfect test by any stretch, and as you can see from the ranges, it's not that consistent. But I'd say it still gives a good rough idea. Aidan9382 (talk) 12:19, 28 September 2022 (UTC)
Well, count me convinced. Thanks for taking the trouble. If no one objects, I'll deploy in a day or two. Sophivorus (talk) 23:44, 28 September 2022 (UTC)
Sounds good to me! {{u|Sdkb}}talk 11:30, 29 September 2022 (UTC)

Hi! Well, I just deployed the 1.5 version. It changes "freefiles" for "onlyfreefiles", changes the default, and also changes the way the "inline" parameter works (now it wraps the excerpt with no tags, rather than <span> tags). I also updated the documentation and removed the parameter "freefiles" from the few articles using it, since free files are now removed by default. Lets hope there's no performance complaints incoming. By the way, I just thought that perhaps it would be better to just remove the "onlyfreefiles" parameter, since under what circumstances would we want to transclude non free files? Cheers! Sophivorus (talk) 14:48, 30 September 2022 (UTC)

We might want to transclude non-free files if there's a fair-use rationale for both articles, but I've never seen it happen. Another possibility is that one excerpt transcludes a large number of files which we know to be free and we want to save the overhead of checking them all every time the page is updated. However, the flag is definitely an optional extra rather than a core feature. Certes (talk) 15:57, 30 September 2022 (UTC)

Image caption fails to display correctly

If anyone is feeling like digging into a tricky problem, please take a look at this new test case, in which the image caption from War of the Austrian Succession is not displayed properly. – Jonesey95 (talk) 17:20, 29 September 2022 (UTC)

I've given this a quick look. Judging from what I'm seeing from testing, I think this is an issue with how infoboxes work vs how regular file captions work. If you attempt to put the caption in an infobox manually, you can see how it also doesn't work. If you look on this version, when the template is enabled, the display is fine. As for displaying it properly - unless theres a template that recreates the infobox's file displaying features, I have no ideas. Aidan9382 (talk) 17:52, 29 September 2022 (UTC)
I don't follow any of this. Both of those permalinks look the same to me (i.e. the asterisks are showing), and the infobox caption at War of the Austrian Succession is working fine (i.e. no asterisks). I have also added a second malfunctioning testcase below the one linked above. – Jonesey95 (talk) 18:01, 29 September 2022 (UTC)
Sorry, I've just realised something - your examples with {{Transclude random excerpt}} are using a different version of Excerpt called Excerpt/portals, which is an outdated(?) version of the current excerpt, so why the second testcase is failing is beyond me, as it works on the current version. As for the first testcase, regular file descriptions just simply dont seem to support bullet lists (* ABC) from what im seeing, which is why it displays so weirdly. My apologies for not realising that at first, I hope that explains it better. As for a fix, I may take a dive into the /portals version to look into potentially merging it with the current main version, but no promises. Hope this helps. Aidan9382 (talk) 18:13, 29 September 2022 (UTC)
Thanks for figuring out that difference. Template talk:Transclude random excerpt is a redirect to this page, which is why I posted here. I hope that someone can fix this minor bug. – Jonesey95 (talk) 00:12, 30 September 2022 (UTC)
As a quick note, /portals definitely has more file issues than I anticipated (Trying to grab the first file from Earth causes its symbol to be extracted from its infobox (see here)). I'm currently looking into working on the /portals system, so I'll see what I can fix. Aidan9382 (talk) 07:59, 30 September 2022 (UTC)
Yes, unfortunately the symbol is the first file used in Earth's infobox. With an article extract we'd use |files=2, but /portals faces the problem that the extracted article changes randomly and different choices require different parameters. Some templates have a facility to attach special parameters to one choice (details), e.g. |1=Moon |2=Earth{{!}}files=2, but it's not widely used and doesn't apply when the list of extracted articles is implicit, e.g. all entries in a list article. Certes (talk) 09:21, 30 September 2022 (UTC)
Ok - after some recent fiddling with Excerpt/portals, I've recently pushed a new (very in-dev) update inspired by Module:Excerpt to the sandbox, which has fixed the failing of captions/images on both Earth and Indigenous peoples of Siberia (Test cases for them are here). I've realised the reason /portals is so long is because it is fully self reliant, so my main aim with this edit was to have the module rely on Module:Transcluder a little (Also, the old grabbing system was very convoluted - more than it needed to be I feel). Feel free to edit any change I've made to the sandbox version, since I've likely missed a lot of things. Aidan9382 (talk) 10:33, 30 September 2022 (UTC)
I wrote most of what became Module:Excerpt/portals. I'm happy to try explaining anything cryptic, or you may find explanations faster in the early edit summaries of Module:Excerpt from which it was effectively forked early in 2020. Certes (talk) 13:46, 30 September 2022 (UTC)
@Jonesey95 (or anyone else): I've attempted to fix the bug you brought up here, though its quite a big change internally. I've never really used /portals before, so I can't test it properly. If the new version looks alright to you, I'd be willing to push it to the main template, seeming as the test cases you linked intially at least are fine so it should be working all good, though it would be nice to see a little more testing done on it. Aidan9382 (talk) 15:10, 30 September 2022 (UTC)
Thanks so much for your work. The test case for War of the Austrian Succession is still showing me asterisks in the caption, but the Siberia test case that follows is working well. That is good progress. – Jonesey95 (talk) 15:59, 30 September 2022 (UTC)
Thats good to hear. As for War of the Austrian Succession, this is an issue that is partially beyond excerpt. When excerpt attempts to extract an image from an infobox, it places the details of the image inside the [[File: syntax. This works for most cases. However, [[File: is a lot more strict with how it displays text, not allowing certain wikitext features like lists.
For a visual example, compare how the infobox has a valid list, while the regular file has no special formatting, despite practically being the same:
Images
 
This is
  • a multiline message
 
This is * a multiline message
{{Infobox |image=[[File:Example.jpg]] |caption=This is
* a multiline message}}
[[File:Example.jpg|thumb|left|This is
* a multiline message]]
The only way this could be fixed is if there was some sort of template that displayed a file like infobox does, but I'm not sure if something like that exists already or not. I don't work with files often, so I may leave this to someone else to try and fix this issue, though I may give it a spin for myself at some point if no one else can. Hope this explains the situation well enough. Aidan9382 (talk) 16:19, 30 September 2022 (UTC)

I am seeing a properly rendered flatlist at the war article. It looks like this:

Images
War of the Austrian Succession
Part of the French–Habsburg rivalry and the Austria–Prussia rivalry
 
Right to left:
Location
{{{place}}}
 
Right to left:
* The Capture of the 'Nuestra Señora de Covadonga' (20 April 1743) * The Battle of Fontenoy (11 May 1745) * The Battle of Hohenfriedberg (4 June 1745) * The Siege of Bergen op Zoom (14 July – 18 September 1747)

And it looks like you are right; that flatlist is not being displayed properly when it is used in a File: invocation

That is strange. I will play with it in a sandbox. – Jonesey95 (talk) 17:14, 30 September 2022 (UTC)

More: It looks like the infobox renders the image without a caption, then follows the completed File: invocation with a line break, and displays the caption as regular text. Maybe the |file= portion of Excerpt/portals needs to do that instead. That fix, or something similar, might also fix the errors described at Module talk:Random slideshow. – Jonesey95 (talk) 17:20, 30 September 2022 (UTC)
I've responded on the page over there about why those have happened. Aidan9382 (talk) 18:25, 30 September 2022 (UTC)
@Jonesey95: I've decided to give a jab at the infobox display issue. Some things are working (the War of the Austrian Succession test case is already looking much better under the new but unstable sandbox), but theres also still a lot of problems with it (just look at the country list test case, its a bit of a mess on Northern Ireland). If you have any suggestions for better ways to format it than right now, or even potential solutions for fixing my current obviously broken setup in the module, feel free to suggest, as files aren't my area of expertise. Aidan9382 (talk) 06:38, 2 October 2022 (UTC)
Note: Turned out I had a singular bad if check. Wow, im dumb. Anyways - I've now implemented a (somewhat stable(?) ) testing grounds for the infobox display mode. It isn't in a completed state from the coding perspective under any definition (dangerous checks and frankly lazy coding), but the functionality of it is at least there from what I see. Opinions? Aidan9382 (talk)
If you're interested at all in the technical details, the main code change is this and I format it using this temporary template Aidan9382 (talk) 07:04, 2 October 2022 (UTC)
The testcases look great. – Jonesey95 (talk) 13:46, 2 October 2022 (UTC)

An update to Excerpt/portals, and a potential suggested change for Excerpt

Hey! After the report from the section above, I decided to give Excerpt/portals quite a bit of a rework, since it was having a few issues with images. This rework is now basically done, and I've implemented the following major changes as part of this rework:

  • Revamped the infobox image grabbing system, letting it now rely on Module:Transcluder - This should fix malformed caption grabbing or aiming for less helpful images.
  • Introduced a new system for displaying images extracted from infoboxes - This was due to the fact that the syntax in Files are limited, and extracting it this way creates a more accurate recreation (see discussion above).

I've also done a bit of miscellaneous work on it (fixing comments, reducing the externalised functions, etc.). Now, since the second major change means a change to how this module displays things and not just its internal workings, I'd like to gather some opinions from other editors if this is good enough, or if it needs some modifying, before attempting to push it.

This brings me to my next point - currently, the main Excerpt module suffers from the same issue (lacking syntax in File: captions). Therefore, if we implement this caption fix for /portals, should we also consider applying it to the main Excerpt module? I don't mind implementing it, but I want to make sure we want it there in the first place.

(Note: Before we finalise any sort of push, the user-space template should probably be moved to the template namespace if we intend to use it).

Thanks. Aidan9382 (talk) 19:49, 2 October 2022 (UTC)

Thanks! I'm not sure how comprehensive Template:Transclude lead excerpt/testcases is, but it should catch most potential errors that came up during original development of what is now /portals. Certes (talk) 20:03, 2 October 2022 (UTC)
Thanks for linking those testcases. While it's mostly working, I'm noticing a few issues crop up (couple to note are a failing of image map (See #Snake) and a bad handling of a coat of arms (See #Albania)), so it seems I've still got some debugging and tuning to do. Hopefully I'll have this sorted soon (and without too much of a mess in code). Aidan9382 (talk) 20:16, 2 October 2022 (UTC)
@Certes: Ok, so, I've done a bit of work on the module, and I've ruled out the majority of the major bugs. However, I've encountered some really weird behaviour. For some reason, on some of the testcases (the ones that use imagemap, eg. #Napoleonic Wars), the entirety of the rest of the text is just cutting itself off after the File, and I'm not entirely sure why this is happening, and why its just entirely on imagemaps, but this isn't looking simple to debug. Do you have any insight into where the article just kinda went off to? I'd assume it was issues with how the new image caption system is, but I've only seen it freak on imagemaps, and never regular images, so I'm a little lost on ideas. If we can get this fixed, that should be everything fixed (note that im torn on whether or not #Royal Navy is the best behaviour, and #Khamgaon feels like a bad grab, so I'm debating on whether or not to count these as issues, since these are the only main discrepencies left apart from fileargs which im working on rn). Aidan9382 (talk) 19:20, 3 October 2022 (UTC)
Sorry, I've no idea about Napoleonic Wars. Usually this sort of thing is syntax errors in the article, such as mismatched brackets or bad nesting in the 200-line infobox. However, the old version seems to parse it, there are no warnings when I preview a dummy edit, linter says it's clean and I can't see anything wrong from a quick visual check. Is there a character limit on any strings, which would be ample for a normal article but insufficient for the nightmare infobox from hell? Certes (talk) 11:34, 4 October 2022 (UTC)
No worries - I just did some quick development prints and discovered theres a phantom ]]</div> being left in during arg grabbing, and since the regex doesnt understand the div tag, it leaves it in, causing something to just not be happy. Where the tag is coming from I'm not sure of yet, but it's a start at least. Can't do coding right now since I'm busy IRL, but I'll hopefully have some kind of result later today. Aidan9382 (talk) 12:04, 4 October 2022 (UTC)
@Certes: Mostly good news. I've located the bug. In short, a /div after the imagemap became isolated from its div pair due to an imagemap becoming a parameter during template processing (it originally wasnt, due to the imagemap being an inside parameter of an |image= arg). This lead to the file arg pattern being unable to properly remove the end of the ]] in the file syntax since it would get scared that it was removing an in-file wikilink as there was a /div after it. Later, fixLinks would then remove the improper wikilink left over and everything after it, causing a complete cut of content. I've fixed this somewhat sloppily by just removing anything beyond the immediate wikilink after imagemap is specified. While this sounds unsafe, I'm pretty sure its impossible for a failed match to happen due to the fact convertImageMap is quite strict on its format, though feel free to implement a better method than what I've done if its concerning.
This also means that, from what I can see in Template:Transclude lead excerpt/testcases, all the bugs should be crossed off, with only minor discrepencies being left (Specifically #Royal Navy and #Khamgaon - See my report page for more details). If you're happy with the changes, I think it might finally be worth pushing this as the live version, though feel free to request any changes first. Aidan9382 (talk) 16:02, 4 October 2022 (UTC)
Thanks for all the good work. I've not examined the code changes in any detail, but I understand the objectives and you seem to have achieved them well. The output looks very compatible, but you could drop a note at WT:WikiProject Portals if you'd like feedback before releasing anything. Certes (talk) 22:00, 4 October 2022 (UTC)

Suggestions of templates to blacklist

{{Further}}, {{Further2}}, {{Broader}}, {{Outline}}, {{Refimprove}}, {{SpecialChars}} -- maybe all of Category:Hatnote_templates? I didn't want to edit Module:Excerpt/config. fgnievinski (talk) 18:16, 30 January 2022 (UTC)

One more: {{Merge from}}, {{Merge to}}; see example at Ribbon theory. @Sophivorus and Certes: fgnievinski (talk) 19:28, 2 March 2022 (UTC)

These templates generally appear on a line of their own, so will be excluded from portals. None of them appear there currently, but please ping me if you see one. They may need adding to /config for non-portal excerpts. Certes (talk) 19:47, 2 March 2022 (UTC)
@Certes: please see my second comment above, about the merge templates, including an example of affected page. fgnievinski (talk) 00:14, 3 March 2022 (UTC)
I've seen all the hatnote templates mentioned above affecting non-portal excerpts, e.g., Surface#In mathematics. fgnievinski (talk) 00:17, 3 March 2022 (UTC)
Yes, they should be excluded from articles too. I maintain Module:Excerpt/portals but can't do much about non-portal excerpts, as changing them requires template editor privilege and I haven't studied the code in detail. Certes (talk) 00:20, 3 March 2022 (UTC)
@Certes: ah, ok, sorry for bothering you; I've created an edit request at Module_talk:Excerpt#Template-protected_edit_request_on_3_March_2022. fgnievinski (talk) 00:43, 3 March 2022 (UTC)
@Fgnievinski Done. Sophivorus (talk) 22:33, 3 March 2022 (UTC)
@Sophivorus: thank you! fgnievinski (talk) 23:31, 3 March 2022 (UTC)

Further suggestions of templates to blacklist

@Sophivorus: Further suggestions: {{Split}}, {{Split section}}, {{Split sections}}, {{Split portions}}, {{Split section portions}}, {{Very long}}. fgnievinski (talk) 23:56, 10 April 2022 (UTC)

And {{POV}} -- again, maybe all of Category:Hatnote_templates? fgnievinski (talk) 00:29, 11 April 2022 (UTC)

And {{more citations needed}} (plus its many redirects). fgnievinski (talk) 03:34, 11 April 2022 (UTC)

@Fgnievinski Hi! I just added Template:POV, Template:Split & redirects. As to the others, if you prepare the regexes, I'll be happy to add them. Sophivorus (talk) 13:44, 12 April 2022 (UTC)
@Sophivorus: here's for {{more citations needed}}: '[Mm]ore citations needed', '[Aa]dd references', '[Aa]dditional citations for verification', '[Aa]dditional citations', '[Aa]dditionalcitations', '[Aa]ddref', '[Aa]dref', '[Cc]itations missing', '[Cc]itations needed', '[Cc]itationsneeded', '[Cc]ite sources', '[Cc]leanup cite', '[Cc]leanup-cite', '[Cc]leanup-verify', '[Ff]ew references', '[Ff]ew refs', '[Ff]ew sources', '[Ff]ewreferences', '[Ff]ewrefs', '[Ii]mprove references', '[Ii]mprove refs', '[Ii]mprove sources', '[Ii]mprove-references', '[Ii]mprove-refs', '[Ii]mproveref', '[Ii]mprovereferences', '[Ii]mproverefs', '[Mm]CN', '[Mm]ORECN', '[Mm]cn', '[Mm]issing citations', '[Mm]ore CN', '[Mm]ore Citations Needed', '[Mm]ore citations', '[Mm]ore cn', '[Mm]ore references needed', '[Mm]ore references', '[Mm]ore refs', '[Mm]ore sources needed', '[Mm]ore sources', '[Mm]oreCN', '[Mm]orecn', '[Mm]oreref', '[Mm]orereferences', '[Mm]orerefs', '[Mm]oresources', '[Nn]eeds additional citations', '[Nn]eeds more citations', '[Nn]eeds more references', '[Nn]eeds more sources', '[Nn]ot verified', '[Nn]otverified', '[Rr]ef Improve', '[Rr]ef improve', '[Rr]ef-improve', '[Rr]efImprove', '[Rr]eference improve', '[Rr]eferenced', '[Rr]efim', '[Rr]efimprove article', '[Rr]efimprove', '[Rr]efimproved', '[Rr]ip', '[Ss]ources needed', '[Ss]ources', '[Uu]nderreferenced', '[Vv]erification', '[Vv]erify', '\+R', '\+r', fgnievinski (talk) 15:29, 12 April 2022 (UTC)
@Sophivorus: and here's for {{POV}} '[Nn]pov', '[Pp]OV check', '[Pp]ov', '[Pp]ov check', '[Nn]POV', '[Nn]eutrality', '[Pp]OV-check-section', '[Pp]oint Of View', '[Pp]OV Check', '[Nn]POV Check', '[Nn]POV check', '[Pp]ov-Check', '[Pp]OV-Check', '[Pp]ov-check', '[Pp]ovcheck', '[Pp]OVCheck', '[Pp]OVcheck', '[Pp]ov Check', '[Pp]oV', '[Nn]eutral', '[Pp]ov-check-section', '[Nn]POV-dispute', '[Pp]OV dispute', '[Tt]oo friendly', '[Ww]hite washed', '[Pp]ov problem', '[Ss]pin', '[Nn]ot neutral', '[Pp]OV-check', '[Nn]PoV', '[Pp]oint of view', fgnievinski (talk) 15:56, 12 April 2022 (UTC)
@Fgnievinski Done, thanks! BTW, to avoid unnecessary performance loss, I think from now on it'd be better to blacklist templates as needed, and not preemptively. What do you think? Cheers! Sophivorus (talk) 17:43, 12 April 2022 (UTC)
@Sophivorus: thank you! all cases that I've reported I had encoutered while using {{excerpt}} in practice. maybe avoid the redirects? although regex usually is cheap. fgnievinski (talk) 17:52, 12 April 2022 (UTC)
@Fgnievinski Ah, I didn't know regexes were cheap, good to know. In any case, I think avoiding redirects is generally a good practice. Many redirects exist which don't have a single use throughout Wikipedia. Sophivorus (talk) 18:39, 12 April 2022 (UTC)

Aligning center

Is there a way I can align excerpts? Danidamiobi (talk) 15:00, 4 November 2022 (UTC)

@Danidamiobi:, what is it you want to do, and can you link an example where Excerpt is being used, and not rendering the way you would wish? Mathglot (talk) 01:33, 5 November 2022 (UTC)

Extraneous paragraph break between successive lines

Section Voting_machine#Current_voting_machines has an excerpt of Electronic voting machine. The first two sentences are in separate lines. They should appear as a single paragraph, no? fgnievinski (talk) 03:39, 13 November 2022 (UTC)

Here's another case: Wave_height#Significant_wave_height, starting at "SWH is used to..." fgnievinski (talk) 17:56, 21 December 2022 (UTC)

Missing minor italics feature

This template does not have the capability of keeping the hatnote compliant with the policy on italics in hatnotes. How can we fix that? Thrakkx (talk) 04:02, 15 December 2022 (UTC)

Do you have an example of a page where this module produces a non-compliant hatnote? Certes (talk) 10:40, 15 December 2022 (UTC)
Ah... do you mean that Medea should be unitalicised in This section is an excerpt from Medea (play), per WP:ITHAT? That sounds awkward, especially when the italicisation of part of a title is wrapped up in nested templates and modules. Certes (talk) 10:47, 15 December 2022 (UTC)
Yes, that's exactly what I mean. Excerpting anything from album, movie, court case, etc., articles will create this issue. Mainstream hatnote templates solve it in two distinct ways:
  • {{Main}} uses the label parameter to solve it – {{Main|Medea (play)|label1=''Medea'' (play)}}
  • {{For}} uses {{!}} to solve it – {{For|the play|Medea (play){{!}}''Medea'' (play)}}
It's awkward but it seems that most other hatnote templates have pulled it off. Thrakkx (talk) 23:39, 16 December 2022 (UTC)
The Main and For examples above seem to be hand-coded – an editor has manually judged that [un]italics are needed for part of a title. The difficult part to automate is not doing the italicisation, but knowing when it should be done. Where in the wikitext or other properties of Medea (play) is there a clue that the first five letters need to be treated specially? Certes (talk) 11:57, 17 December 2022 (UTC)
My understanding is that the responsibility of determining when to [un]italicize is left to the editor because there is no surefire way to automate it. Sure, you could detect albums, TV shows, and court cases using the corresponding infoboxes, but how will you reliably automate the process for Yes and no, Wikipedia Star Trek Into Darkness controversy, and Witch (word)? You could try searching for the several templates that italicize article titles, like {{Italic title}} and {{DISPLAYTITLE}}, but if it were doable, the other templates would have done it by now.
Is it not possible to replicate one of the two existing solutions? Thrakkx (talk) 21:10, 17 December 2022 (UTC)
Main and For work because an editor inserts the double apostrophe by hand. Module:Excerpt generates hatnotes automatically and can't guess whether the title has italics (or other typography such as a lower case initial and superscripts, e.g. x1 Centauri). Sometimes there is an explicit DISPLAYTITLE which we could extract, but more often it's buried in the implementation of an infobox. Short of maintaining a duplicate implementation of every infobox, the only way we could do it accurately is to add a new optional parameter resembling DISPLAYTITLE. Certes (talk) 12:03, 18 December 2022 (UTC)
I guess I don't really understand why it's not possible to add a formatting label to the template. Even though the hatnote is created automatically, surely somewhere there is a place where we can format the wikilink, as it works for the other templates I mentioned? Am I confusing the template with the module? Thrakkx (talk) 19:19, 22 December 2022 (UTC)
I've added an optional displaytitle parameter in the sandbox. If someone kindly reveals which article has a broken hatnote that it would improve, I'll be able to test the change. Certes (talk) 20:17, 22 December 2022 (UTC)
@Thrakkx: (or anyone): is it worth pursuing |displaytitle= in {{excerpt}} (implemented here)? If so, Sophivorus knows the code better than most and may want to take a look. (Take care not to promote the sandbox-only change in line 7 to the main module too!) Certes (talk) 16:43, 29 December 2022 (UTC)
@Certes: This is great! I tested a simple italics case and the x1 Centauri case here and here, respectively. It seems to work perfectly. Thrakkx (talk) 16:54, 29 December 2022 (UTC)
@Certes @Thrakkx Deployed! Thanks both for all the good work! Sophivorus (talk) 12:55, 30 December 2022 (UTC)

Edit request 9 March 2023

Description of suggested change: add Template:Decadebox to the list of blacklisted templates. I want to experiment with transcluding leads for decade articles into century pages (i.e. add the lead of 90s into 1st century). I see little reason why decadeboxes would excerpted into other articles.

Koopinator (talk) 15:21, 9 March 2023 (UTC)
@Sophivorus: maybe I should've done this in another thread, but I've done it here. Koopinator (talk) 16:57, 9 March 2023 (UTC)
Nevermind, I figured out a work=around. Koopinator (talk) 20:21, 9 March 2023 (UTC)

Bug with italics adjacent to apostrophes

The following text in the source page causes problems in the excerpt:

the ''[[Roman Missal]]'''s Ritual Masses

For example, see Dedication#Dedication of churches. Daask (talk) 19:19, 10 March 2023 (UTC)

Yes. Use {{'}} for the actual apostrophe. – Jonesey95 (talk) 19:46, 10 March 2023 (UTC)

Shorten birth-death string

Excerpt is handy for grabbing the lead (or parts) of biographical articles into other articles with just a brief summary of the individual, but the extensive birth-death information typically present in biographical articles is almost always unneeded and unwanted in an article with only a brief section about them. I hacked together template Sbds as an initial attempt to address this; you can see it in action here:

I haven't tried to make it bullet-proof as it's just a hack, so it fails in various conditions, such as when the parenthetical with the birth/death info also has a pronunciation key, as in this failed example:

I will need something like this before I can release Draft:French historiography, but it will need to be thought through and improved, and then, hopefully, incorporated into the module. One feature I'd like to see, is a birth/death option which allows you to configure various actions: drop vital stats completely, keep years only (as in the template), drop extraneous parenthetical material (like pronunciation, spelling in non-Latin, and so on). Would appreciate your thoughts. Mathglot (talk) 20:11, 25 February 2023 (UTC)

Ernest Renan uses {{snd}} instead of an actual dash. That expands to &nbsp;&ndash;&#32; which doesn't contain a dash. You could add & to the character set of dashes. Experimentation suggests that you need a % in front of the &, even though & is not a special character in Scribunto/Lua regexp. Certes (talk) 21:26, 25 February 2023 (UTC)
Thanks for that; I missed that bit at the Renan article; that does suggest making the template more robust. About your specific point: assuming you're talking about the pattern fragment [-–—], I'm not sure what you mean by "add & to the character set of dashes"—why would we want to do that? Mathglot (talk) 21:46, 25 February 2023 (UTC)
I assume the [-–—] is there to limit the search to ranges like 1823–1892 and avoid other patterns with eight digits like a phone or ISBN number. The Renan article, even after expansion of snd and other templates, doesn't have any of those three characters between the years; instead it has ...1823&nbsp;&ndash;&#32;2 October 1892. Sadly, Lua patterns can't use alternation such as [-–—]|&ndash;, but a nasty hack is to check for any old HTML entity instead of the dash with [-–—&]. Despite what the manual implies, that didn't work for me; I had to escape the & with a %: [-–—%&]. By the way, normal practice is to replace by %1–%2 (unspaced en-dash), per MOS:RANGE. Certes (talk) 22:01, 25 February 2023 (UTC)
Ah, thanks for that clarification. I had previously understood the part about the Renan failure case being due to my pattern not handling the expansion of {{snd}}; the part I didn't get originally, was the bit about the ampersand, which now I do, thanks to your explanation. I'm aware of the lack of support for alternation (that has given me headaches in the past) but I was not aware of the nasty hack, so thanks for that one! Understood about MOS:RANGE; I think I'll leave it the "wrong" way at Renan, so I can play with the template using your hack and see if I can get it working for that case.
That still leaves open the idea—which I guess I should have labeled a "proposal" in the section header—of importing this feature as an enhancement to the module, and I hope to get feedback from more editors about this. Mathglot (talk) 22:25, 25 February 2023 (UTC)

Hope that some module writers will drop by and comment; this would be a helpful addition. Mathglot (talk) 08:33, 4 March 2023 (UTC)

@Mathglot @Certes Hi! I started developing a first version of the "fixBirthDeath" functionality (see here) but I encountered several issues. It seems the pattern is matching all sorts of non-birth-death parts, including stuff inside templates and references. I did a first fix attempt by limiting the matching to the first paragraph only, but it's not very elegant and issues remain (see Module:Excerpt/testcases). Ideas? Sophivorus (talk) 11:50, 4 March 2023 (UTC)
I'm not seeing anything blatantly wrong in the testcases, but then I'm not sure where to look. Can you give an example, e.g. the tenth word in #Section should read Foo but reads Bar? One option is to limit to a smaller range than the first paragraph, e.g. the first 200 characters. Certes (talk) 21:34, 4 March 2023 (UTC)
Thank you! Would it help, if the functionality were only activated by some new, template parameter? That way, the user could check if it was doing anything it shouldn't, and turn it off otherwise? Secondly: my draft version was pretty much targeted at the first sentence of biographical articles (unless you can think of other places it would be useful?) so maybe if the pattern detected a bolded substring at the beginning of the string (i.e., something that looks like a person's name) followed by the date bit, that would narrow it down? Also, my original regex was a quick & dirty targeted to handle that one article I'm developing, just as a proof of concept; I can try revisiting it to come up with something more robust. If you can list a few cases that are failing in the way you describe, I'll try and tweak the regex. (edit conflict) Mathglot (talk) 21:42, 4 March 2023 (UTC)
Started to think about a parameter name, and coming up with a short param name that is somewhat indicative of its purpose is not easy. Maybe |briefdates= or something? Mathglot (talk) 21:45, 4 March 2023 (UTC)
@Certes Ah, my bad, the problematic testcases are the ones at Template:Excerpt/testcases. @Mathglot Limiting to the first sentence would help, as well as setting the parameter off by default. Naming the parameter "briefdates" sounds like an improvement over "fixbirthdeath"! Sophivorus (talk) 16:18, 5 March 2023 (UTC)
Looking at the module as a whole, with all of Lua available rather than its limited regexp syntax, we can do a lot more. I've had a go in the sandbox. Certes (talk) 17:45, 5 March 2023 (UTC)
Having a look at some testcases, it looks to work mostly well, though it's still trying to pull out some weird things. For example, it tries to pull out 2006–2807 from Gejiu or 2020–2020 from Geneva. In both cases, it appears to be trying to grab something out of a reference. Aidan9382 (talk) 18:28, 5 March 2023 (UTC)
Thank you for this! I updated Draft:French historiography to use the sandbox, and assuming I updated correctly, it succeeds on the same ones as the "Sbds" did (sections §§ Robert Aron, Pierre Chaunu, Georges Duby, and Albert Soboul all look good  Y) and fails on the same one: (§ Ernest Renan  N), which I'm assuming has something to do with the pronunciation guide between the opening left paren and the birth date in that section. Mathglot (talk) 19:00, 5 March 2023 (UTC)
I've tightened up the sandbox checks. I hope this might fix Geiju and Geneva: do you have a testcases page anywhere to test that? I've also added a check for {{snd}} especially for Ernest Renan. (Now that the regexp is in a module rather than standalone, it's being presented with the unexpanded template rather than "&ndash;".) Certes (talk) 19:27, 5 March 2023 (UTC)
(edit conflict)I've added new testcases section § Biographies, but it fails with "Script error: The function "briefdates=yes" does not exist" and I'm not sure what I did wrong. Mathglot (talk) 19:29, 5 March 2023 (UTC)
Fixed (the function always goes first in an invoke). Aidan9382 (talk) 19:34, 5 March 2023 (UTC)
Oops! Thanks. Mathglot (talk) 19:38, 5 March 2023 (UTC)

Nice improvement at the testcases by Sophivorus to use the side-by-side, collapsible table approach; much easier comparison this way. Let's recall that yellow means "different" and green means "same", not "pass"; in particular, three cases in the Biographies section are green because the sandbox displays it the same way as the template does. Ernest Renan is now yellow, because it's working  Y; thanks! Mathglot (talk) 12:05, 6 March 2023 (UTC)

@Certes, Aidan9382, and Sophivorus: this is looking good; any objection to moving the sandbox to live? Mathglot (talk) 18:28, 22 March 2023 (UTC)

It seems a clear improvement, so let's go for it. Certes (talk) 18:31, 22 March 2023 (UTC)
@Mathglot @Certes Hi! I'm ready to deploy but my only question is if this feature should be enabled by default. What do you think? Is it robust enough? Also, the testcase about "François Maurice Adrien Marie Mitterrand" isn't working, but I guess that's because {{spnd}} is being used instead of a dash. This isn't a blocker for deployment though. I think in these cases, the most reasonable solution is that the interested editor simply replaces the template for a dash in the source article. Sophivorus (talk) 18:54, 22 March 2023 (UTC)
I don't think it should be the default, but my opinion shouldn't carry much weight as I've mainly used the module in portals, which are no longer a typical use case. Certes (talk) 19:15, 22 March 2023 (UTC)
That's a good question, and I'm kind of on the fence about whether it should be the default. On the one hand, in s/w generally, I think backward compatibility is a good thing so I'm usually opposed to defaulting a new feature if it would change the behavior of existing uses. On the other hand, I'm trying to imagine why someone would want a bio lead excerpt to remain the old way, which would argue for making it the default. Some RW data would be nice: I don't know how easy it would be to find uses in the wild excerpting the lead of a biographical article; maybe a clever Petscan or other tool could find examples from half a dozen users, and we could poll them? Failing that, I guess I lean slightly to "opt-in", requiring use of |briefdates=yes to engage the functionality, but I'd love to get more feedback, especially from real users of it, as I kind of hope that data will show that everybody wants it, in which case it should be the default. Mathglot (talk) 19:32, 22 March 2023 (UTC)
Or, maybe I'm overthinking it? It's really not difficult to add the new param. Let's see what Aidan says. Mathglot (talk) 19:35, 22 March 2023 (UTC)
Well, I just deployed the new version, but with briefdates disabled by default. My concern is mainly that if enabled by default, it may break some excerpts that don't have birth-death dates but have other numbers for other reasons. Over time, if the feature proves popular and robust, we may enable it by default. Sophivorus (talk) 21:44, 22 March 2023 (UTC)
Thank you, that's fine by me and sounds like the right decision, including for the additional reasons you stated. A big thank you to everyone who worked on this or commented. This is really helpful, and also makes the draft I'm working on much better; thanks all! Mathglot (talk) 00:14, 23 March 2023 (UTC)

Synchronizer

@Certes @Aidan9382 Hi! I recently developed this tool for synchronizing modules across wikis (and also rewrote this documentation on how to create a cross-wiki module). I thought you'd want to know in case you want to synchronize or globalize Module:Excerpt/portal or any other module you're working on or interested in (see for example my workboard). Also, soon I'll try to do some changes to Module:Excerpt to fix some i18n issues with it (that caused zhwiki to fork it). Cheers! Sophivorus (talk) 15:13, 3 February 2023 (UTC)

@Certes @Aidan9382 @Uzume Hi guys! I finally accepted that the "master" version of this module and Module:Transcluder is the one at enwiki, where all the development actually happens, and not the one at MediaWiki.org as I pretended. So I just finished migrating Module:Transcluder/testcases to enwiki. However, for some reason the documentation at Module:Transcluder/testcases/doc is not getting transcluded. Anyone knows what could be wrong?? Sophivorus (talk) 17:29, 21 March 2023 (UTC)
@Sophivorus: Having a quick read at the code, this could be just how the Documentation module works. Judging by Module:Documentation/doc, docs are loaded in via MediaWiki:Scribunto-doc-page-show. This page calls Documentation with _content (which is the main controller of the text judging from this) set to the content of the page given by contentTitle, which has it's target doc page calculated by this function, which appears to be trimming the target page down to basepage/doc due to the fact it contains "/testcases", which it considers as something to be trimmed (along with "/sandbox").
TL;DR the target page is hardcoded and we have no proper way to invoke the doc template with different arguments, so I'm not sure how to fix this, but there's at least the rough idea of why it isn't working. Aidan9382 (talk) 17:53, 21 March 2023 (UTC)
Interestingly enough, /testcases pages seem to normally display a notice about testcases generated by MediaWiki:Scribunto-doc-page-does-not-exist, and only transcludes the wrong /doc page when a correct /doc page exists. Wonder if this could be reasonably fixed in the main Documentation module itself, even if it means a rule just for the module namespace. Aidan9382 (talk) 20:41, 21 March 2023 (UTC)
@Sophivorus @Aidan9382 @Mr. Stradivarius: I agree. This seems to be how Module:Documentation is designed to work for Scribunto modules here at enwiki (which is interesting since the default for Scribunto is to make every /doc into wikitext and transclude it to its parent module). I am not exactly sure why Jackmcbarn decided to play such games with Module:Documentation and in scribunto-doc-page-does-not-exist and scribunto-doc-page-does-not-exist when he could have just changed such things directly in scribunto-doc-page-name (e.g., changing it to Module:{{ROOTPAGENAME:$1}}/doc).
As it currently sits, Scribunto uses its default scribunto-doc-page-name Module:$1/doc to determine which pages should be treated as "doc" by making their content model wikitext (vs. Scribunto), however scribunto-doc-page-does-not-exist, scribunto-doc-page-show and scribunto-doc-page-header totally ignore their $1 parameter argument value instead blindly calculating their own values.
This makes for an interesting scenario as /doc pages use {{documentation subpage}} (via scribunto-doc-page-header) to state they are the documentation for their parent when they aren't actually transcluded there by scribunto-doc-page-show. Also Module:Documentation seems to claim and link to the /doc subpages making statements like "The above documentation is transcluded from Module:Transcluder/testcases/doc." which are clearly not true (as the content is entirely different).
I suppose a workaround solution would be to transclude the sub-module /doc (e.g., Module:Transcluder/testcases/doc) in the base module /doc (e.g., Module:Transcluder/doc) when the current page is a sub-module (e.g., Module:Transcluder/testcases).
A real solution would be to fix the four scribunto-doc-page- messages (name, does-not-exist, show and header) to be in alignment (probably by actually using their parameter value). —Uzume (talk) 21:00, 21 March 2023 (UTC)
@Sophivorus @Aidan9382 @Mr. Stradivarius I am not entirely sure why this was done but methinks perhaps the original idea was to force sandbox modules to use the parent /doc. That said, the right way to have fixed that was probably to have more complex logic in scribunto-doc-page-name so sandboxes just did not have their own /doc forcing them to share with their parent /doc and just use the Scribunto provided $1 in scribunto-doc-page-does-not-exist, scribunto-doc-page-show and scribunto-doc-page-header.
One thing to be concerned about is how the /doc content gets expanded. If Module:Documentation does the actual expansion via something like mw.getCurrentFrame():expandTemplate then this counts against the resource limits of Module:Documentation for that page render. An alternative is to pass this in as a parameter value (not unlike the default value of scribunto-doc-page-show does with {{$1}}\n<hr />). This is what the _content parameter (different from content) is about.
I did a little experimentation and if I provide both |content= and |1= to {{#invoke:documentation|main}} when {{{1}}} does not exist then it shows {{{content}}} but links to {{{1}}} allowing one to "create" (with preload). That might be useful for scribunto-doc-page-does-not-exist on sub-modules without /doc but that have a base or root module with a /doc.
In any event, this is clearly beyond the topic of Module:Excerpt so this discussion should likely be moved elsewhere. —Uzume (talk) 04:34, 22 March 2023 (UTC)
Thinking about it, testcases are normally ran on the associated talk page of a module instead of a doc subpage. Pending some sort of fix to how the doc pages are loaded, moving Module:Transcluder/testcases/doc to Module talk:Transcluder/testcases (without redirect so scribunto-doc-page-does-not-exist is loaded instead) would fix the issue, which I've gone ahead and done for now.
As for how to actually handle changes in the documentation to get around this type of (quite rare) scenario, starting a conversation at Module talk:Documentation about this would likely be the best idea. Aidan9382 (talk) 11:25, 22 March 2023 (UTC)
Thanks, I just fixed the testcases to account for the new location and they all pass now, yay! As to the fix to the /doc madness, I'd be happy to help by doing the required edit if someone figures it out, but please lets continue at Module talk:Documentation. Sophivorus (talk) 12:20, 22 March 2023 (UTC)

In a more on-topic note, the Synchronizer tool can now be run from enwiki by adding the following to your common.js:

if ( mw.util.getParamValue( 'withJS' ) === 'MediaWiki:Synchronizer.js' ) {
	mw.loader.load( '//www.mediawiki.org/wiki/MediaWiki:Synchronizer.js?action=raw&ctype=text/javascript' );
}

and then adding one or more calls to Template:Synchronize to your sandbox. Once the tool is a bit more mature, I may request adding it to MediaWiki:Synchronizer.js. In the meantime, any early feedback and testing is very welcome, cheers! Sophivorus (talk) 12:23, 22 March 2023 (UTC)

@Sophivorus: What about putting that in m:Special:MyPage/global.js? Wouldn't that mean I could run it anywhere where that is available (i.e., has mw:Extension:GlobalCssJs loaded) so long as I can generate the button (needing something like the Scribunto module for that)? —Uzume (talk) 01:47, 23 March 2023 (UTC)
Yes, it should work! Sophivorus (talk) 02:10, 23 March 2023 (UTC)

Proposal: add param 'after=' to append user text

Please consider adding param |after=text string which would allow the user to append any (reasonable) text string to the excerpted text. I plan to use this to add a reference, which currently doesn't work, because it appears outside the <div> sitting in a paragraph by itself, but I can see other uses for it, too. This was inspired by Template:Testcase_table#Parameters |_before= and |_after=. Another way to accomplish this, might be to provide |style=, assuming that I could then apply |style=display:inline (or inline-block) and have it apply to the outside block element. In this case, I could just append my citation immediately after the {{Excerpt}} and have it render properly right after the excerpted content, if there are no stray newlines or blanks that would interfere. (I can imagine that some restrictions on the value might be required; notably, no embedded templates that generate block content.) Thoughts on this? Mathglot (talk) 03:23, 24 March 2023 (UTC)

Recent regex changes

Hi @Aidan9382. I notice you recently made this change to the config file. I do not think this is a 1:1 change. For example, "led absent" would not have matched before, but now matches. Is there something superior about using ? instead of |? They both seem like valid regex to me. I guess if we wanted we could change it to (?:ea|de) to be a bit more orthodox, but (ea|de) also seems fine to me. Thanks. –Novem Linguae (talk) 13:58, 30 April 2023 (UTC)

@Novem Linguae: | isn't actually valid regex in lua, since lua's system is a slight bit different from normal regex (something I forgot myself back then too) (see mw:Extension:Scribunto/Lua reference manual#Patterns), so that was actually trying to match the literal string (ea|de) instead of ea or de. I opted for ea?de? since it would match both lead and lede without writing an entirely different regex for the alternative, and I don't imagine matching led is going to be a huge issue, though if I'm wrong, I can change that. Aidan9382 (talk) 14:04, 30 April 2023 (UTC)
Ah I see. Thank you for teaching me something new. Yeah, Lua's unique flavor of regex is confusing and a source of bugs. And unfortunately it's not quite standard enough to be in the common regex tools such as https://regex101.com/. Ah well, maybe someday :) –Novem Linguae (talk) 14:07, 30 April 2023 (UTC)

Problem with excerpt?

A complex onlyinclude issue is being discussed at WP:VPT#Help/Problem with excerpt? Certes (talk) 21:01, 29 April 2023 (UTC)

The issue turned out to be a blacklist entry for {{unr}} accidentally stripping {{unreleased}} too. It has been fixed. Certes (talk) 18:27, 30 April 2023 (UTC)

Citation errors in transcluded sections

@Mikeblas: I think there's another bug in this template: why did this reference need to be manually copied in order to display correctly? Jarble (talk) 15:42, 30 May 2023 (UTC)

Not sure what the bug is -- I don't expect transclusion to bring reference definitions. Since Gipp11 wasn't defined in the source article, the reference to it was marked as undefined and the page placed in Category:Pages with broken reference names. -- Mikeblas (talk) 15:50, 31 May 2023 (UTC)

Not working why?

  Resolved

{{Excerpt|Democracy|only=paragraph|hat=no}}Moxy-  06:01, 6 June 2023 (UTC)

@Moxy: That's because it should be only=paragraphs not only=paragraph, though it definitely shouldn't just give nothing when a mistake like that is done. Aidan9382 (talk) 06:27, 6 June 2023 (UTC)
Thank you...but odd {{Excerpt|Authoritarianism|only=paragraph|hat=no}} works Moxy-  06:31, 6 June 2023 (UTC)
@Moxy: Oh yeah. Looking more into this, it appears this module is, for whatever reason, unable to fetch just the first paragraph on Democracy, which is what you get if you use only=paragraph, but the rest work fine (which is why it works for only=paragraphs). I'm gonna go see if I can find out why that is. Aidan9382 (talk) 06:37, 6 June 2023 (UTC)
Well, certaintly doesn't help that Module:Transcluder is getting confused by a stray space at the end of the {{Short description}} and thinking that that was the first paragraph instead of the actual paragraphs.
@Moxy: I've gone ahead and implemented a fix here, and your test case from above now works, meaning only=paragraph should be valid again. Thanks for the bug report. Aidan9382 (talk) 06:55, 6 June 2023 (UTC)
Thank you so much Moxy-  12:07, 6 June 2023 (UTC)

Some sections can't be displayed as excerpts

I tried to include this section as an excerpt in this article:

{{Excerpt|Anonymous function|Perl}}

But the template displays an error message instead of an excerpt: "Section 'Perl' is empty." Jarble (talk) 16:46, 8 June 2023 (UTC)

@Jarble: That's because, by default, Excerpt will stop when it reaches a subsection, and that section is entirely comprised of a subsection. You can either transclude the subsection directly (Perl 5), or specify |subsections=yes in your given example - either of those should get it to transclude correctly. Aidan9382 (talk) 17:34, 8 June 2023 (UTC)
@Aidan9382: It sometimes doesn't display an excerpt even if the section is not a subsection, like this:
{{excerpt|Immigration and crime|Worldwide|subsections=yes}}
Is this due to the onlyinclude tag in the article? I don't know if it's possible to include excerpts from articles that use this tag. Jarble (talk) 21:56, 22 June 2023 (UTC)
Yes: the onlyinclude tag's sole purpose is to prevent anything outside the onlyinclude block from being transcluded. It's not possible to include excerpts from other parts of the article. The tag seems to be there for the benefit of Immigration#Crime, which transcludes the entire Immigration and crime article but expects to get only the lead. Perhaps Immigration should change to request only what it wants (the lead), after which the onlyinclude tag could be removed allowing other pages to transclude other parts of Immigration and crime. Moving the "which parts to copy" logic out of the donor article and into the receivers allows multiple receivers to exist without tripping over each other. Certes (talk) 22:41, 22 June 2023 (UTC)

Doc page should mention failed excerpt due to section rename

Reminder to self (or anyone): the doc page should say something about the case of a failed section excerpt due to a renamed section heading. The shortcut MOS:BROKENEXCERPTLINKS could be used to link there; we might also indicate that that shortcut could be placed in hidden comments in articles that use {{Excerpt}}, in the style of MOS:HIDDENLINKADVICE for wikilinks to sections. Mathglot (talk) 01:01, 9 July 2023 (UTC)

I've made some updates to the /doc page, and there is now a new § Error messages section, and the list of pros & cons previously in the lead, are now in their own section at § Advantages and disadvantages. I haven't done anything about adding the shortcut yet. Mathglot (talk) 00:47, 10 July 2023 (UTC)

@Sophivorus:, thanks for your further edits improving the error messages section. Are you sure about this edit? It seems like it *ought* to work that way, but does it? When I look at the code, it doesn't seem to do that:

code snippet where it searches for the page and tests for redirect (current rev. 1146117553‎)
	if not page then return getError( 'no-page' ) end
	local title = mw.title.new(page)
	if not title then return getError( 'no-page' ) end
	if title.isRedirect then title = title.redirectTarget end
	if not title.exists then return getError( 'page-not-found', page ) end
	page = title.prefixedText

Admittedly, I don't know Lua, and in particular, I don't know what the line if not title is testing for, but it looks at first blush like it's overloading the 'no-page' error with two different kinds of things, but 'page-not-found' only occurs under one condition. Can you comment? Are there testcases for these? Thanks, Mathglot (talk) 02:10, 10 July 2023 (UTC)

@Mathglot Hi! The code was alright, but I improved it for clarity and to better handle the case in which invalid titles (such as "2 > 1" which contains the invalid character ">") are given. You can find test cases for errors at Template:Excerpt/testcases#Errors and Module:Excerpt/testcases#Errors. Thanks for the keen eye! Sophivorus (talk) 16:40, 10 July 2023 (UTC)
Thanks! Mathglot (talk) 16:51, 10 July 2023 (UTC)

Substitution bug

The template {{reference heading}} is failing to display here (upper right). It started displaying properly when I substed at the source. Any idea what's happening here? {{u|Sdkb}}talk 22:47, 12 July 2023 (UTC)

The template wasn't being picked up since its name matched one of the blacklisted terms that was a bit too generalised. I've changed it so {{Reference heading}} should now work again. Aidan9382 (talk) 06:07, 13 July 2023 (UTC)

Proposal: make subsectioning more robust

The template doc rightly has a caution (see bottom of Template:Excerpt § Parameters) about the use of |subsections=yes because of the risk of unexpected results due to incompatible section heading levels (H-depth), but we could make the code more robust to handle this. The idea would be to introduce conditional demotion of transcluded section headers based on a configurable value. Since we already have a param named |subsections= with only a binary yes/no value, we can just reuse that param and allow numeric values which would correspond to section heading demotion level, i.e., the number of equal signs to add fore and aft. For example:

  • |subsections=1

would cause all H2 subsection headers in the excerpt to become H3 ("H2 + 1"), all H3's to become H4's, and so on. Setting the param value to 2 would demote two levels, and so on. (Some thought would have to be given to what happens after six, e.g., "H5 + 2" = 7, which is beyond the max level wikimedia supports; probably we should just turn it into boldface plain text with a prefixed anchor to preserve in-link addressability, so, something like: <strong>{{vanchor|Deeply nested header}}</strong>.) Negative values would cause promotion (fewer equal signs) and should probably have a stopper at level 2. The current yes value would essentially mean the same as |subsections=0. Thoughts? Mathglot (talk) 19:48, 13 July 2023 (UTC)

I'm rethinking the "re-use" idea, because I'm worried that |subsections=1 could be interpreted by a newer user as, "only include the first subsection". So maybe we need two params after all; leaving |subsections=yes alone, plus a new one, |depth=+1 or |level=+1 to do what was proposed above. (Or, 'hdepth', or 'hlevel'). Mathglot (talk) 20:00, 13 July 2023 (UTC)

Proposal: pre-load a helpful preview editintro notice on clicking 'edit' in hatnote

Although I love {{excerpt}}, I think there's a risk for users unfamiliar with it when they click the [edit] link in the hatnote of the excerpted text on the destination page. You end up editing a different page, and this can be confusing. Even as a veteran user of it, I sometimes forget where I am, and even if not it can be annoying to get back to the previous page you were on without carefully browser-back-arrowing right through the preview page of the edit you just did; if you made several edits to the page, it becomes impossible in any practical sense.

On the transcluding page where we click the 'edit' hatnote, we have the name of the page we are on ({{PAGENAME}}), and we know where we are going (the page underlying the 'edit' link), and it seems to me we could do an {{edit}}-like |editintro=, maybe with params that get passed to it to insert the name of the page we were on before, and display it in a "Go back" message. If that's not possible because the notice can only be static, then just a preview mode edit notice stating in big, glaring font geared to get their attention, "You are now editing DEST_PAGE, not the page you were on when you clicked [edit]. Is this where you want to be? If not, click your browser back button", and if it is possible, then link back to the page. If the edit link or excerpt module has access to the edit summary field, it would be really nice to prepopulate that with a brief link message: "Edited via {{excerpt}} at [[OTHERPAGENAME]]", which the editor could expand on before saving. Are either of these possible? Mathglot (talk) 23:15, 8 July 2023 (UTC)

A workaround just occurred to me: make the hatnote 'edit' link open the window in a new page or tab (overriding user preference). That would at least preserve navigability back to the original page you were on, although you might still need a static notice above the preview window to let them know what just happened and where you are now. Also: don't know if or how any of this would work in VE, as I rarely use it. Mathglot (talk) 23:21, 8 July 2023 (UTC)
@Mathglot Hi! These are great ideas and highly doable. I'll wait for others to input their thoughts and if no objections or better ideas arise, I'll try to do some implementation, cheers! Sophivorus (talk) 11:40, 9 July 2023 (UTC)
Hi Sophivorus, your comments and volunteership (is that a word?) are much appreciated! I'm subscribed, and will be watching with interest. Mathglot (talk) 17:08, 9 July 2023 (UTC)

Just added VPR to the list; let's give it a few days in case there's some interest there, or at the projects. Thanks, Mathglot (talk) 23:49, 9 July 2023 (UTC)

Crickets. Sophivorus, if you feel like taking this on, I think we've been patient, and there's no opposition. Do you think we could place the editintro text in a separate page (subpage, config file, or whatever) so that it could be worked on by non-Lua coders externally? Plain text, JSON, whatever is easiest for the module. Or maybe it's a template, if parameters apply? Mathglot (talk) 03:22, 15 July 2023 (UTC)
@Mathglot Hi! I just implemented a first version of the "editintro" parameter, see Module:Excerpt/sandbox and Template:Excerpt/sandbox, as well as Template:Excerpt/editintro and the final result at Template:Excerpt/testcases. Unfortunately, I think it's not possible to pass the name of the previous page to the editintro (the "preloadparams" parameter is for passing parameters to preloads, not editintros). Thoughts? Sophivorus (talk) 16:23, 26 July 2023 (UTC)

Template-protected edit request on 30 July 2023

Add '[Ss]idebar with collapsible lists' as a blacklisted template (https://en.wikipedia.org/w/index.php?title=Module:Excerpt/config&oldid=1165133830#L-42). Wpstatus (talk) 16:02, 30 July 2023 (UTC)

The regexes in the blacklist should prevent a template from being included if the regex matches the template name at least partially, so that should already be covered by '[Ss]idebar'. Is there an example where this isn't happening? Aidan9382 (talk) 16:11, 30 July 2023 (UTC)
Sorry, I was looking at the wrong template. The template that should be added to the blacklist is Template:Islam. Thanks! Wpstatus (talk) 16:20, 30 July 2023 (UTC)
@Aidan9382 In addition to Template:Islam, could you please also add Template:Creationism2 to the blacklist? Wpstatus (talk) 19:09, 31 July 2023 (UTC)
  Done. Aidan9382 (talk) 19:25, 31 July 2023 (UTC)

Square brackets retained despite links=no parameter.

The following discussion is closed. Please do not modify it. Subsequent comments should be made in a new section.

I recently used {{excerpt|Frenemies (podcast)|Label 1=Frenemies|links=no|hat=no}} This may well an error of implementation on my part but it returned the following paragraph with open square brackets at the start of the first (parent page) wikilinked term.

Frenemies is a podcast hosted by Trisha Paytas and Ethan Klein on the H3 Podcast. Running from September 15, 2020 to June 8, 2021, the podcast focused on discussing personal experiences, pop culture, internet drama and mental health.[1] It consisted of 39 episodes and two accompanying vlogs. Paytas and Klein's friendship was occasionally tumultuous, leading to episodes that were incomplete due to a verbal argument.[2] The podcast came to an end during its 39th episode, after a dispute with Paytas and Klein about podcast revenue[3] and production ownership.[4] Despite this, Frenemies gained recognition in the podcasting realm and found a place in numerous Top 50 lists,[5][6] frequently pulling in millions of viewers per episode.[4][7]

References

References

  1. ^ Dodgson, Lindsay. "A podcast hosted by 2 of YouTube's most controversial personalities is creating new conversations about mental health". Insider. Retrieved 2023-05-31.
  2. ^ "'Frenemies' Is The Most Unexpectedly Cathartic Podcast on the Internet". Junkee. 2021-04-13. Retrieved 2023-05-31.
  3. ^ Hampton, Rachelle; Kircher, Madison Malone (2021-06-12). "The Inexplicable Saga of Internet Provocateur Trisha Paytas, Explained". Slate. ISSN 1091-2339. Retrieved 2023-05-31.
  4. ^ a b Bergman, Lindsay Dodgson, Sirena. "How 'Frenemies,' one of YouTube's buzziest podcasts, crashed and burned in less than a week". Insider. Retrieved 2023-05-31.{{cite web}}: CS1 maint: multiple names: authors list (link)
  5. ^ "Podcasting Hasn't Produced A New Hit in Years". Bloomberg.com. 2022-01-09. Retrieved 2023-05-31.
  6. ^ "Edison Research Top 50 Podcasts". www.edisonresearch.com. Retrieved 2023-05-31.
  7. ^ "Trisha Paytas steps down from 'Frenemies' podcast after tense dispute on the show". Mashable. 2021-06-08. Retrieved 2023-05-31.

I manually pasted the content into the article, but I thought I'd bring it up in-case it is a bug. Pabsoluterince (talk) 12:45, 2 August 2023 (UTC)

@Pabsoluterince You might want to post this over at Module talk:Transcluder, as that's the module that actually handles retrieving the text and removing the wikilinks. --Ahecht (TALK
PAGE
) 13:47, 2 August 2023 (UTC)
Okay thanks. Pabsoluterince (talk) 14:07, 2 August 2023 (UTC)
At Module:Transcluder#L-584, [^|] should probably become [^%]|], so it doesn't mistake [[Link1]] and [[Link2|Pipetext]] for a single wikilink to article called "Link1]] and [[Link2". I can't verify this easily, because previewing a module change without template editor privilege requires a lot of tedious copying to titles we can edit. On reflection, doesn't that whole block require a lot of % escapes for magic characters such as [ and ]? Certes (talk) 13:48, 2 August 2023 (UTC)
The discussion above is closed. Please do not modify it. Subsequent comments should be made on the appropriate discussion page. No further edits should be made to this discussion.

Template doc revamped

I've significantly re-organized the § Parameters section of the Template:Excerpt/doc page. The basic idea is to make it clearer, and more comprehensible by specifying all the params briefly at first so they are quickly findable, followed by a longer, § Details section with a fuller treatment. The previous version looked like an intractable wall of text. I've subdivided the params into three functional groups as a framework to better understand the different nature of the params:

  • source page identification – 2 params (page name, section name)
  • transclusion config – 10 params (paragraphs, lists, templates, only, etc.)
  • style + extra features - 7 params (bold, briefdates, displaytitle, etc.)

and also introduced some terminology (element type and element item) in an attempt to explain conceptually what domain the transclusion config params act upon. Please have a look at Template:Excerpt/doc#Parameters; your comments below and/or direct updates to the doc are appreciated. Thanks, Mathglot (talk) 23:15, 11 August 2023 (UTC)

Cite error, sometimes

Greetings! Thanks for this most excellent template. I'm seeing "Cite error: There are <ref> tags on this page without content in them" in here. Curiously, that same error is absent in a similar page. I don't see any glaring omission in the reference defined at that point in the text (right after "... the founding editor"). The two pages are similar, except mostly for the replacement of Template:Infobox with Template:Infobox/sandbox2. I'd be glad if someone more knowledgeable could further investigate the issue, please. Many thanks! fgnievinski (talk) 01:48, 10 August 2023 (UTC)

The issue here is that the excerpt has |templates=infobox journal specified, which acts as a whitelist and means all other templates are excluded by default (See line 208). The ref tag that errors in the excerpt is entirely made of a {{Cite web}}, which gets excluded as it doesn't match the given |templates= input, which is why a cite error is made. Aidan9382 (talk) 06:37, 10 August 2023 (UTC)
Indeed, using "template=infobox journal,cite web" avoided the problem. Thank you for the clarification, I've incorporated it in the documentation. fgnievinski (talk) 07:17, 23 September 2023 (UTC)

More suggestions of templates to blacklis

@Sophivorus: here's another one, please: '.*[Tt]opic.*' (used here). and may I ask if the existing '.*[Tt]imeline' shouldn't be generalized as '.*[Tt]imeline.*'? fgnievinski (talk) 00:14, 13 April 2022 (UTC)

@Fgnievinski Done, both! Thanks! Sophivorus (talk) 20:32, 13 April 2022 (UTC)

@Sophivorus: here's another one, please: '.*[G]lobal.*' (template:globalize). Thanks. fgnievinski (talk) 19:29, 11 May 2022 (UTC)

@Fgnievinski Done! Sophivorus (talk) 13:42, 12 May 2022 (UTC)

@Sophivorus: could you please add '[Mm]erge*', possibly removing '[Mm]erge from','[Mm]erge to'? It's affecting Projectile#Kinetic_projectiles. Thanks fgnievinski (talk) 20:55, 9 August 2022 (UTC)

@Fgnievinski Done! Sophivorus (talk) 21:16, 9 August 2022 (UTC)

@Sophivorus: could you please add '[C]lean*' and '[B]are*', please? It's affecting Electronic voting by country. Thanks fgnievinski (talk) 01:44, 13 November 2022 (UTC)

@Fgnievinski Done! Sophivorus (talk) 16:00, 14 November 2022 (UTC)

@Sophivorus: could you please add '[N]o footnotes', '[C]itations', '[I]nline', please? It's affecting Topological space. Thanks. fgnievinski (talk) 18:03, 25 November 2022 (UTC)

@Fgnievinski Done! Sophivorus (talk) 18:19, 27 November 2022 (UTC)

@Sophivorus: could you please add '[E]xpand*' (after Template:expand list and related ones), please? It's affecting Topological space. Thanks. fgnievinski (talk) 01:19, 29 January 2023 (UTC)

@Fgnievinski Done! Sophivorus (talk) 02:29, 29 January 2023 (UTC)

@Sophivorus: could you please add '*footnote*', '*cites*' (after Template:More_footnotes_needed#Redirects and related ones), please? It's affecting Plane (mathematics). Thanks. fgnievinski (talk) 03:10, 20 February 2023 (UTC)

@Fgnievinski Done! (added *footnote* and *citations* rather than *cites*) Sophivorus (talk) 14:31, 21 February 2023 (UTC)

@Sophivorus: could you please add '*[Tt]echnical*' (after Template:Technical#Redirects and related ones), please? It was affecting Slope stability. Thanks! fgnievinski (talk) 05:50, 13 March 2023 (UTC)

@Fgnievinski Done! Sophivorus (talk) 21:03, 13 March 2023 (UTC)

@Sophivorus: could you please add '*[Ss]ections*' (after Template:Sections and related ones), please? It was affecting Wake (physics). Thanks! fgnievinski (talk) 01:16, 10 May 2023 (UTC)

Done! Sophivorus (talk) 02:35, 10 May 2023 (UTC)

@Sophivorus: could you please add '*[Hh]atnote' (after Template:Hatnote), please? It's affecting Spacetime#Riemannian_geometry. I suspect it might be affecting other pages. Thanks! fgnievinski (talk) 02:37, 25 September 2023 (UTC)

@Fgnievinski Done! Sophivorus (talk) 12:59, 25 September 2023 (UTC)

Infobox figure

I'm a big fan of this module, thank you for synchronizing it to Wikipedia in other languages! [2] I've found a particular usage problem in a testcase: an infobox figure filename is left behind. Could someone more familiar with Lua check how the problem could be avoided, please? fgnievinski (talk) 07:31, 23 September 2023 (UTC)

@Fgnievinski: This is specifically an issue with Module:Excerpt instead of Module:Transcluder (to be specific, somewhere around this section), so I've moved the discussion here. Aidan9382 (talk) 14:28, 25 September 2023 (UTC)
When extracting from pt:Mostrar código-fonte de Manifestações golpistas no Brasil após as eleições de 2022, the footer parameter, which contains a colon, seems to be treated as if it were a filename (File:Caminhoneiros...). The check probably needs to be stricter than %[?%[?.-:, perhaps by replacing . by something. I'm not sure what "something" is: %a works in most languages but not in Russian (Файл:Somefile), Chinese (文件:Somefile), Afrikaans (Lêer:Somefile), etc. (Random tip: German WP is great for looking at pages like WP:Namespace in many languages, because it still has the old language picker that doesn't shrivel up when you pick the first language!) Certes (talk) 16:05, 25 September 2023 (UTC)

Extraneous paragraph break between successive lines [unarchived]

Section Voting_machine#Current_voting_machines has an excerpt of Electronic voting machine. The first two sentences are in separate lines. They should appear as a single paragraph, no? fgnievinski (talk) 03:39, 13 November 2022 (UTC)

Here's another case: Wave_height#Significant_wave_height, starting at "SWH is used to..." fgnievinski (talk) 17:56, 21 December 2022 (UTC)

Here's yet another case: Tailings_dam#Failures. fgnievinski (talk) 03:39, 18 October 2023 (UTC)

There is a line break in the source of the excerpted lead paragraph of Tailings dam failure. I've seen this before in other examples, where {{excerpt}} appears to replace a line break with a paragraph break. Mathglot (talk) 15:25, 19 October 2023 (UTC)