From 35f4c25b3f0375933275b3516ea0c1fe92506950 Mon Sep 17 00:00:00 2001
From: Brion Vibber
Date: Tue, 6 Feb 2007 07:45:06 +0000
Subject: [PATCH] * (bug 8897) Fix whitespace removal for interlanguage links
with link prefix
---
RELEASE-NOTES | 1 +
includes/Parser.php | 4 ++--
maintenance/parserTests.txt | 47 +++++++++++++++++++++++++++++++++++++
3 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index 8b84ab5d15..89f0dedccc 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -178,6 +178,7 @@ lighter making things easier to read.
* Clean up session checks to better handle the case where the session was
opened during the current request. May help with some caching corner
cases.
+* (bug 8897) Fix whitespace removal for interlanguage links with link prefix
== Languages updated ==
diff --git a/includes/Parser.php b/includes/Parser.php
index 66d6eb16c7..e975359911 100644
--- a/includes/Parser.php
+++ b/includes/Parser.php
@@ -1721,8 +1721,8 @@ class Parser
wfProfileIn( "$fname-interwiki" );
if( $iw && $this->mOptions->getInterwikiMagic() && $nottalk && $wgContLang->getLanguageName( $iw ) ) {
$this->mOutput->addLanguageLink( $nt->getFullText() );
- $s = rtrim($s . "\n");
- $s .= trim($prefix . $trail, "\n") == '' ? '': $prefix . $trail;
+ $s = rtrim($s . $prefix);
+ $s .= trim($trail, "\n") == '' ? '': $prefix . $trail;
wfProfileOut( "$fname-interwiki" );
continue;
}
diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt
index 5162b360ea..4ddaac243b 100644
--- a/maintenance/parserTests.txt
+++ b/maintenance/parserTests.txt
@@ -1566,6 +1566,53 @@ Interwiki link with fragment (bug 2130)
!! end
+!! test
+Interlanguage link
+!! input
+Blah blah blah
+[[zh:Chinese]]
+!!result
+Blah blah blah
+
+!! end
+
+!! test
+Double interlanguage link
+!! input
+Blah blah blah
+[[es:Spanish]]
+[[zh:Chinese]]
+!!result
+Blah blah blah
+
+!! end
+
+!! test
+Interlanguage link, with prefix links
+!! options
+language=ln
+!! input
+Blah blah blah
+[[zh:Chinese]]
+!!result
+Blah blah blah
+
+!! end
+
+!! test
+Double interlanguage link, with prefix links (bug 8897)
+!! options
+language=ln
+!! input
+Blah blah blah
+[[es:Spanish]]
+[[zh:Chinese]]
+!!result
+Blah blah blah
+
+!! end
+
+
##
## XHTML tidiness
###
--
2.20.1