From 0527e119b3fe84460a6112648329b373135422d5 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 21 Apr 2005 01:33:32 +0000 Subject: [PATCH] Tidy's & normalization is kind of weird and doesn't always act the way we want. Run the same amp cleanup whether we're using tidy or not. --- includes/Parser.php | 43 +++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 26 deletions(-) diff --git a/includes/Parser.php b/includes/Parser.php index 784b4a8021..2dc5968ab9 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -183,33 +183,22 @@ class Parser $text = $this->unstrip( $text, $this->mStripState ); + # Clean up special characters, only run once, next-to-last before doBlockLevels - global $wgUseTidy; - if(!$wgUseTidy) { - $fixtags = array( - # french spaces, last one Guillemet-left - # only if there is something before the space - '/(.) (?=\\?|:|;|!|\\302\\273)/' => '\\1 \\2', - # french spaces, Guillemet-right - '/(\\302\\253) /' => '\\1 ', - '/
/i' => '
', - '/
/i' => '
', - '/
/i' => '
', - '/<\\/center *>/i' => '
', - ); - $text = preg_replace( array_keys($fixtags), array_values($fixtags), $text ); - $text = Sanitizer::normalizeCharReferences( $text ); - } else { - $fixtags = array( - # french spaces, last one Guillemet-left - '/ (\\?|:|;|!|\\302\\273)/' => ' \\1', - # french spaces, Guillemet-right - '/(\\302\\253) /' => '\\1 ', - '/
/i' => '
', - '/<\\/center *>/i' => '
' - ); - $text = preg_replace( array_keys($fixtags), array_values($fixtags), $text ); - } + $fixtags = array( + # french spaces, last one Guillemet-left + # only if there is something before the space + '/(.) (?=\\?|:|;|!|\\302\\273)/' => '\\1 \\2', + # french spaces, Guillemet-right + '/(\\302\\253) /' => '\\1 ', + '/
/i' => '
', + '/
/i' => '
', + '/
/i' => '
', + '/<\\/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 ); @@ -217,6 +206,8 @@ class Parser $text = $wgContLang->convert($text); $this->mOutput->setTitleText($wgContLang->getParsedTitle()); $text = $this->unstripNoWiki( $text, $this->mStripState ); + + global $wgUseTidy; if ($wgUseTidy) { $text = Parser::tidy($text); } -- 2.20.1