From 17d54cfb4bb5ba9603b8a9ccc8a702ab4ff4969c Mon Sep 17 00:00:00 2001
From: Brion Vibber
Date: Sat, 11 Jun 2005 01:54:03 +0000
Subject: [PATCH] * (bug 2372) Fix rendering of empty-title inline interwiki
links
---
RELEASE-NOTES | 1 +
includes/Parser.php | 8 +++++++-
includes/Title.php | 2 +-
maintenance/parserTests.txt | 9 +++++++++
4 files changed, 18 insertions(+), 2 deletions(-)
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
--
2.20.1