Page MenuHomePhabricator

Automatically catch when a fragment is missing trailing punctuation
Closed, ResolvedPublicFeature

Description

When links are pasted into spaces that autolink them, trailing punctuation in the fragment is often excluded from the automatic link.

e.g. https://en.wikipedia.org/wiki/Wikipedia:Village_pump_(policy)#At_what_point_can_an_administrator_reasonably_be_called_a_%22senior%22_administrator?

We actually catch this in the redirect popup, because the discussiontoolsfindcomment API copes with it:

CleanShot 2026-02-26 at 09.43.17@2x.png (604×286 px, 34 KB)

However, in the fairly common case where the topic is still on the current page we could fix this up as we already do with unescaped spaces in the fragment.

Event Timeline

Change #1244702 had a related patch set uploaded (by DLynch; author: DLynch):

[mediawiki/extensions/DiscussionTools@master] Check for a version of a heading with missing punctuation before warning

https://gerrit.wikimedia.org/r/1244702

This looks like this is a fix for one of my biggest regular frustrations. Thank you!
IIUC, your current patchset is just detecting ! and ? -- If feasible, I'd suggest also adding : and " and . -- those are the other most common culprits (in English at least) from my long experience with this issue.

Sidenote, it would also be amazing if this fix could also be done for non-DiscussionTools pages, too. I suspect that is much harder though. The main 3 tasks for that are listed at the top of https://en.wikipedia.org/wiki/User:Quiddity/Problems_with_punctuation_in_links (I won't mention here for now, to avoid any false hope!)

Change #1244702 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Check for a version of a heading with missing punctuation before warning

https://gerrit.wikimedia.org/r/1244702

Change #1244823 had a related patch set uploaded (by DLynch; author: DLynch):

[mediawiki/extensions/DiscussionTools@master] Add more potential trailing punctuation to check for missing fragments

https://gerrit.wikimedia.org/r/1244823

@Quiddity there you go, those have been added.

And you're right, it'd be a different path to cope with punctuation in _all_ headings. We have the advantage here that for discussiontools we're already watching for this to do the highlighting and archive-redirection, whereas in regular article views there's nothing like that happening. (If I had my druthers, I'd probably change how we generate heading IDs in mediawiki so that they'll never include this sort of punctuation character.)

Change #1244823 merged by jenkins-bot:

[mediawiki/extensions/DiscussionTools@master] Add more potential trailing punctuation to check for missing fragments

https://gerrit.wikimedia.org/r/1244823