From: Brion Vibber
Date: Sat, 11 Jun 2005 01:54:03 +0000 (+0000)
Subject: * (bug 2372) Fix rendering of empty-title inline interwiki links
X-Git-Tag: 1.5.0beta1~202
X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/%27%20%20%20mw.html.escape%28%20mw.util.getUrl%28%20%27link%27%20%29%20%29%20%20%20%27?a=commitdiff_plain;h=17d54cfb4bb5ba9603b8a9ccc8a702ab4ff4969c;p=lhc%2Fweb%2Fwiklou.git
* (bug 2372) Fix rendering of empty-title inline interwiki links
---
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 77632388f0..34ef2bfb08 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -275,6 +275,7 @@ Various bugfixes, small features, and a few experimental things:
* Changed user_groups format quite a bit.
* (bug 2368) Avoid fatally breaking PHP 4.1.2 in a debug line
* (bug 2367) Insert correct redirect link record on page move
+* (bug 2372) Fix rendering of empty-title inline interwiki links
=== Caveats ===
diff --git a/includes/Parser.php b/includes/Parser.php
index 0c7a142f65..fd9b960cb6 100644
--- a/includes/Parser.php
+++ b/includes/Parser.php
@@ -1433,7 +1433,13 @@ class Parser
$s .= $prefix . $sk->makeKnownLinkObj( $nt, $text, '', $trail );
continue;
}
- if ( $nt->isAlwaysKnown() ) {
+ if( $nt->isLocal() && $nt->isAlwaysKnown() ) {
+ /**
+ * Skip lookups for special pages and self-links.
+ * External interwiki links are not included here because
+ * the HTTP urls would break output in the next parse step;
+ * they will have placeholders kept.
+ */
$s .= $sk->makeKnownLinkObj( $nt, $text, '', $trail, $prefix );
} else {
/**
diff --git a/includes/Title.php b/includes/Title.php
index 2c5111a979..92d813aad9 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -1969,7 +1969,7 @@ class Title {
*
*/
function isAlwaysKnown() {
- return ( 0 == $this->mNamespace && "" == $this->mDbkeyform )
+ return $this->isExternal() || ( 0 == $this->mNamespace && "" == $this->mDbkeyform )
|| NS_SPECIAL == $this->mNamespace || NS_IMAGE == $this->mNamespace;
}
diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt
index 846ed0806a..f644fe2b6d 100644
--- a/maintenance/parserTests.txt
+++ b/maintenance/parserTests.txt
@@ -1069,6 +1069,15 @@ Inline interwiki link
!! end
+!! test
+Inline interwiki link with empty title (bug 2372)
+!! input
+[[MeatBall:]]
+!! result
+MeatBall:
+
+!! end
+
!! test
Interwiki link encoding conversion (bug 1636)
!! input