From: Brion Vibber
Date: Thu, 21 Apr 2005 11:40:58 +0000 (+0000)
Subject: * (bug 1938) Fix normalization of character references in link text and
X-Git-Tag: 1.5.0alpha1~201
X-Git-Url: http://git.cyclocoop.org/%22.%24match%5B1%5D.%22?a=commitdiff_plain;h=85e6160dfd874e44b945b72a3752d529ae377a8a;p=lhc%2Fweb%2Fwiklou.git
* (bug 1938) Fix normalization of character references in link text and
other replaced portions; run after link replacement but before tidy.
(Tidy will do some odd things if used, with breakage resulting from corner
cases.)
---
diff --git a/includes/Parser.php b/includes/Parser.php
index 2ff7786a4c..daf10df0d0 100644
--- a/includes/Parser.php
+++ b/includes/Parser.php
@@ -197,7 +197,6 @@ class Parser
'/<\\/center *>/i' => '',
);
$text = preg_replace( array_keys($fixtags), array_values($fixtags), $text );
- $text = Sanitizer::normalizeCharReferences( $text );
# only once and last
$text = $this->doBlockLevels( $text, $linestart );
@@ -207,6 +206,7 @@ class Parser
$this->mOutput->setTitleText($wgContLang->getParsedTitle());
$text = $this->unstripNoWiki( $text, $this->mStripState );
+ $text = Sanitizer::normalizeCharReferences( $text );
global $wgUseTidy;
if ($wgUseTidy) {
$text = Parser::tidy($text);
diff --git a/maintenance/parserTests.txt b/maintenance/parserTests.txt
index 51203a5ceb..e791a4641c 100644
--- a/maintenance/parserTests.txt
+++ b/maintenance/parserTests.txt
@@ -997,7 +997,7 @@ Interwiki link encoding conversion (bug 1636)
*[[Wikipedia:ro:Olteniţa]]
*[[Wikipedia:ro:Olteniţa]]
!! result
-
!! end
+
+!! test
+Character reference normalization in link text (bug 1938)
+!! input
+[[Main Page|this&that]]
+!! result
+this&that
+
+!!end
+
TODO:
more images
more tables