Module talk:Excerpt

New tool and grant ideas
Hi guys! Tonight I had an idea for a new tool, called ExcerptHunter (inspired in CitationHunt). It's basically a semi-automatic tool for doing Template:Excerpt. I wrote a small demo to help explain. First add the following to your common.js:

Then visit User:Sophivorus/ExcerptHunter and you should see the interface. Note that clicking Publish doesn't work yet, but I think the interface already conveys the idea. What do you think? The tool could grow in many ways. For example, by allowing users to limit articles to a category or topic of interest, by showing a live preview next to the wikitext, by working in other wikis, etc.

However, this new tool idea, along with some bugs and feature requests that have been piling up, and other ideas I have in mind (such as generalizing Module:Transcluder into a regex-based Module:WikitextParser) all add up to more than I'm able to handle in my volunteer time.

Therefore, I'm thinking on requesting a Rapid Grant to help me develop ExcerptHunter, WikitextParser, as well as any ideas you come up with and generally catching up and giving a boost to everything excerpt-related. What do you think? Would you support such a grant? Would you like more details, or request some specific work to be done? Looking forward to your reply! Kind regards, Sophivorus (talk) 04:28, 3 December 2023 (UTC)


 * @Certes @Aidan9382 I should also mention that it would be a pleasure and an honor to to present a shared grant with you, in case you're interested!!! Sophivorus (talk) 13:40, 4 December 2023 (UTC)
 * Please please don't do this in a widespread or semiautomated way, or add tools that make it easier for others to do. The excerpt template is one of the most harmful (reader- and especially author-hostile) changes to Wikipedia in recent years, and its significant proliferation will do dramatic damage to the encyclopedia project. –jacobolus (t) 19:18, 10 December 2023 (UTC)
 * Well, I guess the silence and concern expressed imply my proposal wouldn't be welcome. Oh well... Sophivorus (talk) 16:54, 18 December 2023 (UTC)
 * I completely agree with @Jacobolus's comment above. It usually does more harm than good. Clayoquot (talk &#124; contribs) 18:44, 13 May 2024 (UTC)

getTags
@Certes @Aidan9382 Hi! Today I added a new getTags method to Module:Transcluder/sandbox. The regexes are still rather simple and probably fail in many edge cases, but once it's more robust it can help us get things like galleries, blockquotes, divs, etc. Furthermore, it could be used in other methods to extract stuff like tags and perhaps even tags. One thing that it should handle though are self-closing tags such as ? == One of the subsections in this article is transcluded even if  is not included as a parameter. This only happens when the section heading is in this format:

The section appears to be included in this excerpt:

Should this section not be transcluded in this case? Jarble (talk) 16:37, 7 March 2024 (UTC)


 * Does this occur only when there is a single equals sign in the heading? Certes (talk) 18:56, 7 March 2024 (UTC)
 * Yes, I've never seen this happen when there is more than one equals sign in the heading. Jarble (talk) 21:47, 7 March 2024 (UTC)
 * Per Help:Wikitext,  Changing to == should fix the problem and potentially fix other problems with the article too. Certes (talk) 23:31, 7 March 2024 (UTC)

Reference error
I just wanted to notify that there is, currently, a reference error with the excerpt in in this article (ref 153). I thought it was related to the fact that it uses a specific template called "Cite Moulin 2004". So I modified the transcluded reference to use a more generic format, but it doesn't appear to have solved the issue. Alenoach (talk) 02:45, 22 March 2024 (UTC)


 * This seems to be an issue with  causing the Cite book inside the reference to be removed, making the reference content empty and causing an error. Aidan9382 (talk) 07:29, 22 March 2024 (UTC)
 * Ok, thanks. I fixed it by whitelisting reference templates with the excerpt parameter "templates=Cite". Alenoach (talk) 01:37, 23 March 2024 (UTC)
 * Actually, sometimes you need a more comprehensive whitelist, like e.g. templates=Cite,cite,Citation,rp Alenoach (talk) 03:00, 23 March 2024 (UTC)

Ref error ruwiki
Hi. I tried to excerpt the lead from Отравление Алексея Навального here - and ref 4 is giving me a reference error. Does anyone know why and how to fix it? Renat 05:53, 22 March 2024 (UTC)

Excerpt a paragraph, less its bundled citation with an embedded list
Having a bundled citation with an embedded bullet list for several different sources is not unusual. I tried excluding a bundled ref at the end of the first paragraph of 2023 Brazilian Congress attack using no and got a weird result, so added no on top of that, but still doesn't look right:

The final text I want to see in the excerpt is, "...and disrupt the democratic transition of power." I want to keep the yes so I can tack on my own ref instead of the bundle. Anything I'm missing here? Mathglot (talk) 06:55, 15 April 2024 (UTC)
 * Something odd is going on. In my (now undone) rev. 1219016229, I attempted a fix by adding a second test after the first, adding param templates:-cite. What happened was that the two tests showed the same result, an improvement over the first attempt, where now there is only a hanging &lt;ref> tag (and no citation content or anything else: just the opening ref tag itself) after the desired text. But the top test in that revision is unchanged from the (only) test in the previous revision (and current revision, after the undo's). So, somehow, the addition of test two in rev. 1219016229 is affecting the result of test 1 in that revision, even though I didn't change that one (afaik). Very odd. Mathglot (talk) 07:15, 15 April 2024 (UTC)
 * Also tried: but no go. Mathglot (talk) 07:19, 15 April 2024 (UTC)
 * Module:Transcluder is getting very confused by this scenario. It appears to be including the list objects from later paragraphs (specifically  and  ), because   seems to think the list objects (which in this case are actually the bundled citations) are unrelated to the paragraph, and therefore not removing them along with said paragraph. This also consumes the references' starting ref tag, so it doesn't get removed later on. Thats why, when you try to do   (so not specificying no lists), you get the 2 bullet points from the next 2 paragraphs leaking out instead. Aidan9382 (talk) 07:45, 15 April 2024 (UTC)
 * Also,  is probably failing because it then removes the ending ref tag to the starting ref tag (the first reference won't be on a newline so it doesnt get picked up as a list by Transcluder, but then the rest of the bundled citation gets consumed). Aidan9382 (talk) 07:47, 15 April 2024 (UTC)

New Template doc section Incompatibilities
I started a new template doc section,, to hold a description (or perhaps a bullet list?) of incompatibilities between Excerpt and other templates, modules, or functions. Please add entries to it that you know of. Thanks, Mathglot (talk) 01:27, 13 June 2024 (UTC)