Standardizing for-see lists edit

I've started a discussion at Wikipedia talk:Hatnote#Standardizing for-see lists about standardizing and centralizing the code that generates lists of "For X, see Y" items in hatnotes. The discussion may affect this page, but is located there as it's relevant to others as well. Please comment there if interested. {{Nihiltres |talk |edits}} 17:26, 27 April 2016 (UTC)Reply

Varied punctuation across for-see lists edit

(pinging Andy) As part of improvements to the list-generating functionality, Module:Hatnote list/sandbox has a feature whereby if any list items contain the separator (a comma), then the list uses the alternate separator (a semicolon). For example:

However, since this happens at the level of andList, different for-see items (each an individual sentence) in a for-see list may use different separators. For example:

Is this behaviour undesirable? It'd take some annoying restructuring to avoid it. {{Nihiltres |talk |edits}} 20:06, 3 May 2016 (UTC)Reply

A big test case:
Looks good :) If we wrote those examples above in prose, APA style (for example) suggests what we see right now – semicolons for comma entries, and commas for general ones. Punctuation collapse looks good too. (I'm not sure if I'll be able to devote as much time as I planned – some new stuff came up very recently. I'm still keeping an eye on this and will help when/where I think I can.)
Inviting other folks who worked on some of these modules/templates, hope you don't mind. Mr. Stradivarius, Codename Lisa, R'n'B, Bkonrad, and Steel1943: thoughts? — Andy W. (talk ·ctb) 22:33, 3 May 2016 (UTC)Reply

Proposal for collapsing final punctuation with piped and italicized titles in hatnote list edit

I want to propose a change that allows final punctuation in the hatnote list to merge/collapse even with an italicized (and therefore de-italicized) title, which WP:ITHAT recommends. The current version can be seen in The Super Mario Bros. Movie, where the hatnote (which I edited for the title to be italicized) ends with both an exclamation mark and a full-stop. Without title italicization, only the exclamation mark appears. I didn't add an equivalent change to the module for bolded text (I have not seen bolded text in a hatnote) but I don't mind someone else also proposing it if they think it's also needed. (You can check the proposed difference here. There was also some talk in Wikipedia talk:Lua about the sandbox code and the proposal itself [link].) LightNightLights (talk) 10:09, 6 April 2023 (UTC)Reply

@LightNightLights and Dexxor: This sounds good; that's a clear bug to be fixed. I apologize for being largely inactive for a while, or I'd have implemented this months ago! I tweaked Dexxor's code a little for brevity and added some test cases to verify that the code should work more or less the way we expect. I don't think that we need to worry about bolding; this regex search suggests that only a couple of pages use bolding in titles, with most of the results being false positives from having a stray apostrophe after italicization (like ''this'''). Are there any remaining concerns before I implement this? {{Nihiltres |talk |edits}} 00:29, 11 November 2023 (UTC)Reply
@Nihiltres: No concerns here. The new code and testcases look good to me. LightNightLights (talkcontribs) 07:37, 11 November 2023 (UTC)Reply
  Done {{Nihiltres |talk |edits}} 21:30, 13 November 2023 (UTC)Reply