Last modified: 2007-10-02 15:04:59 UTC
As proposed on [[Wikipedia:Village pump (technical)#Why does the "pipe trick" not work on place names?]], the attached patch makes the pre-save context link expansion (see [[Help:Pipe trick]]) trigger on commas as well as parentheses. This means, in particular, that: 1. [[Foo, Bar|]] will expand to [[Foo, Bar|Foo]], and 2. [[|Foo]] on page named [[Foobar, Baz]] will expand to [[Foo, Baz|Foo]]. Due the expansion being done during the PST, this change will not affect existing content in any way. Also, since the "empty pipe" syntax does not conflict with normal link syntax, users are unlikely to run afoul of this effect by accident. That said, there is one case where the new behavior may be unexpected and perhaps, in some cases, unwanted: the syntax [[Ns:Foo, Bar|]], which used to expand to [[Ns:Foo, Bar|Foo, Bar]] will after the change expand to [[Ns:Foo, Bar|Foo]] instead.
Created attachment 2155 [details] Patch to extend the pipe trick syntax to titles with commas
(In reply to comment #0) > Due the expansion being done during the PST, this change will not affect > existing content in any way. Also, since the "empty pipe" syntax does not > conflict with normal link syntax, users are unlikely to run afoul of this effect > by accident. That said, there is one case where the new behavior may be > unexpected and perhaps, in some cases, unwanted: the syntax [[Ns:Foo, Bar|]], > which used to expand to [[Ns:Foo, Bar|Foo, Bar]] will after the change expand to > [[Ns:Foo, Bar|Foo]] instead. Why not just give the priority to colon instead of comma? Of course, if such a thing is possible.
Created attachment 2157 [details] New patch, gives priority to parens over comma, more tests Here's a new patch which uses two regexps to ensure that [[Foo, Bar (baz)|]] becomes [[Foo, Bar (baz)|Foo, Bar]] and [[Foo (baz), Bar|]] becomes [[Foo (baz), Bar|Foo]]. I've also made the behavior of the [[|Foo]] and [[Foo|]] syntaxes consistent, such that, for example, both consider the namespace part of the context. There is, however, one notable exception: If the page title is of the form "Foo (bar), Baz", the link [[|Foobar]] becomes [[Foobar, Baz|Foobar]], _not_ [[Foobar (bar), Baz|Foobar]]. I believe this is what most people would expect, since titles with parens followed by a comma are fairly uncommon.
This looks good. I'd hate to see it die from lack of interest.
*** Bug 7489 has been marked as a duplicate of this bug. ***
Implemented in r16804.
*** Bug 11530 has been marked as a duplicate of this bug. ***