Extend context link ("pipe trick") syntax to pages with commas in title
Closed, ResolvedPublic

Description

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.


Version: 1.7.x
Severity: enhancement

bzimport added a project: MediaWiki-Page-editing.Via ConduitNov 21 2014, 9:16 PM
bzimport set Reference to bz6826.
Ilmari_Karonen created this task.Via LegacyJul 26 2006, 7:59 PM
Ilmari_Karonen added a comment.Via ConduitJul 26 2006, 8:00 PM

Patch to extend the pipe trick syntax to titles with commas

attachment pipetrick.diff ignored as obsolete

bzimport added a comment.Via ConduitJul 26 2006, 11:58 PM

dungodung wrote:

(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.

Ilmari_Karonen added a comment.Via ConduitJul 27 2006, 9:24 PM

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.

Attached: pipetrick2.diff

bzimport added a comment.Via ConduitAug 12 2006, 4:57 PM

neroute2 wrote:

This looks good. I'd hate to see it die from lack of interest.

brion added a comment.Via ConduitOct 4 2006, 5:29 PM
  • Bug 7489 has been marked as a duplicate of this bug. ***
Ilmari_Karonen added a comment.Via ConduitOct 4 2006, 9:33 PM

Implemented in r16804.

brion added a comment.Via ConduitOct 2 2007, 3:04 PM
  • Bug 11530 has been marked as a duplicate of this bug. ***

Add Comment