From: Mark A. Hershberger
Date: Tue, 8 Mar 2011 18:09:34 +0000 (+0000)
Subject: * Followup r76127 and r83521 by adding parsertests and using caseFold
X-Git-Tag: 1.31.0-rc.0~31555
X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=9488bbc6f286eb619922ed300650f0204248e8eb;p=lhc%2Fweb%2Fwiklou.git
* Followup r76127 and r83521 by adding parsertests and using caseFold
---
diff --git a/includes/Linker.php b/includes/Linker.php
index 32f1a57c4a..5a499cd021 100644
--- a/includes/Linker.php
+++ b/includes/Linker.php
@@ -286,11 +286,14 @@ class Linker {
}
# Get a default title attribute.
+ global $wgLang;
$known = in_array( 'known', $options );
if ( $target->getPrefixedText() == '' ) {
# A link like [[#Foo]]. This used to mean an empty title
# attribute, but that's silly. Just don't output a title.
- } elseif ( $known && strtolower($linkText) !== strtolower($target->getPrefixedText() ) ) {
+ } elseif ( $known &&
+ $wgLang->caseFold($linkText) !== $wgLang->caseFold($target->getPrefixedText() ) )
+ {
$defaults['title'] = $target->getPrefixedText();
} elseif ( !$known ) {
$defaults['title'] = wfMsg( 'red-link-title', $target->getPrefixedText() );
diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt
index 8677bcf7f7..32d5a3cbc5 100644
--- a/tests/parser/parserTests.txt
+++ b/tests/parser/parserTests.txt
@@ -8433,6 +8433,26 @@ Special characters in embedded file links (bug 27679)
!! end
+!! article
+A
+!! text
+A
+!! endarticle
+
+!! article
+Ã
+!! text
+Ã
+!! endarticle
+
+!! test
+Bug#542 Link text shouldn't be duplicated in title attributes
+!! input
+[[A]] [[a]] [[Ã]] [[ä]]
+!! result
+A a à ä
+
+!! end
TODO:
more images