From 85e6160dfd874e44b945b72a3752d529ae377a8a Mon Sep 17 00:00:00 2001
From: Brion Vibber
Date: Thu, 21 Apr 2005 11:40:58 +0000
Subject: [PATCH] * (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.)
---
includes/Parser.php | 2 +-
maintenance/parserTests.txt | 14 ++++++++++++--
2 files changed, 13 insertions(+), 3 deletions(-)
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
--
2.20.1