From: Jens Frank Date: Sun, 10 Apr 2005 19:16:48 +0000 (+0000) Subject: BUG#1860 - Anchors of interwiki links did not get normalized X-Git-Tag: 1.5.0alpha1~310 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=d238b93290c86e2495e3e67d99630d9cdace2471;p=lhc%2Fweb%2Fwiklou.git BUG#1860 - Anchors of interwiki links did not get normalized --- diff --git a/includes/Linker.php b/includes/Linker.php index a035471d37..84dc09af17 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -137,7 +137,7 @@ class Linker { * Pass a title object, not a title string */ function makeLinkObj( &$nt, $text= '', $query = '', $trail = '', $prefix = '' ) { - global $wgOut, $wgUser, $wgLinkHolders; + global $wgOut, $wgUser, $wgLinkHolders, $wgInputEncoding; $fname = 'Skin::makeLinkObj'; wfProfileIn( $fname ); @@ -163,7 +163,26 @@ class Linker { $trail = $m[2]; } } + + # Check for anchors, normalize the anchor + + $parts = explode( '#', $u, 2 ); + if ( count( $parts ) == 2 ) { + $anchor = urlencode( do_html_entity_decode( str_replace(' ', '_', $parts[1] ), + ENT_COMPAT, + $wgInputEncoding ) ); + $replacearray = array( + '%3A' => ':', + '%' => '.' + ); + $u = $parts[0] . '#' . + str_replace( array_keys( $replacearray ), + array_values( $replacearray ), + $anchor ); + } + $t = "{$text}{$inside}"; + if( $this->postParseLinkColour ) { # There's no existence check, but this will prevent # interwiki links from being parsed as external links.