From: Ilmari Karonen Date: Wed, 26 Jul 2006 19:33:13 +0000 (+0000) Subject: more minor tweaking to context link code, +comment X-Git-Tag: 1.31.0-rc.0~56138 X-Git-Url: http://git.cyclocoop.org/%22.%24h.%22?a=commitdiff_plain;h=c05f5dcafe7be7707b00939f3afb0569a6e25260;p=lhc%2Fweb%2Fwiklou.git more minor tweaking to context link code, +comment --- diff --git a/includes/Parser.php b/includes/Parser.php index ccb72b34d2..e26bcff0dd 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -3581,7 +3581,7 @@ class Parser $tc = "[$wgLegalTitleChars]"; $namespacechar = '[ _0-9A-Za-z\x80-\xff]'; # Namespaces can use non-ascii! - $conpat = "/^{$tc}+? \\(({$tc}+)\\)$/"; + $conpat = "/^{$tc}+?( \\({$tc}+\\)|)$/"; $p1 = "/\[\[(:?$namespacechar+:|:|)({$tc}+?)( \\({$tc}+\\)|)\\|]]/"; # [[ns:page (context)|]] $p2 = "/\[\[\\|({$tc}+)]]/"; # [[|page]] @@ -3590,8 +3590,9 @@ class Parser $t = $this->mTitle->getText(); if ( preg_match( $conpat, $t, $m ) && '' != $m[1] ) { - $text = preg_replace( $p2, "[[\\1 ({$m[1]})|\\1]]", $text ); + $text = preg_replace( $p2, "[[\\1{$m[1]}|\\1]]", $text ); } else { + # if $m[1] is empty, don't bother duplicating the title $text = preg_replace( $p2, '[[\\1]]', $text ); }