Fix fragments on interwiki links and in-wiki links with case sensitive option on.

* [ 991569 ] Interwiki Links to Sections Do Not Work
This commit is contained in:
Brion Vibber 2004-07-29 04:48:42 +00:00
parent a5a174cfe0
commit a3e3155936
2 changed files with 24 additions and 7 deletions

View file

@ -1151,7 +1151,7 @@ class Parser
$iw = $nt->getInterWiki();
if( $noforce ) {
if( $iw && $this->mOptions->getInterwikiMagic() && $nottalk && $wgLang->getLanguageName( $iw ) ) {
array_push( $this->mOutput->mLanguageLinks, $nt->getPrefixedText() );
array_push( $this->mOutput->mLanguageLinks, $nt->getFullText() );
$tmp = $prefix . $trail ;
$s .= (trim($tmp) == '')? '': $tmp;
continue;

View file

@ -344,6 +344,15 @@ class Title {
}
return $this->mPrefixedText;
}
# As getPrefixedText(), plus fragment.
function getFullText() {
$text = $this->getPrefixedText();
if( '' != $this->mFragment ) {
$text .= '#' . $this->mFragment;
}
return $text;
}
# Get a URL-encoded title (not an actual URL) including interwiki
function getPrefixedURL()
@ -370,13 +379,19 @@ class Title {
if ( "" == $this->mInterwiki ) {
$p = $wgArticlePath;
return $wgServer . $this->getLocalUrl( $query );
} else {
$baseUrl = $this->getInterwikiLink( $this->mInterwiki );
$namespace = $wgLang->getNsText( $this->mNamespace );
if ( "" != $namespace ) {
# Can this actually happen? Interwikis shouldn't be parsed.
$namepace .= ":";
}
$url = str_replace( "$1", $namespace . $this->mUrlform, $baseUrl );
if ( '' != $this->mFragment ) {
$url .= '#' . $this->mFragment;
}
return $url;
}
$p = $this->getInterwikiLink( $this->mInterwiki );
$n = $wgLang->getNsText( $this->mNamespace );
if ( "" != $n ) { $n .= ":"; }
$u = str_replace( "$1", $n . $this->mUrlform, $p );
return $u;
}
# Get a URL with an optional query string, no fragment
@ -746,6 +761,8 @@ class Title {
# Initial capital letter
if( $wgCapitalLinks && $this->mInterwiki == "") {
$t = $wgLang->ucfirst( $r );
} else {
$t = $r;
}
# Fill fields