From: Brion Vibber Date: Thu, 21 Apr 2005 01:33:32 +0000 (+0000) Subject: Tidy's & normalization is kind of weird and doesn't always act the way we X-Git-Tag: 1.5.0alpha1~217 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/%22%20.%20%22?a=commitdiff_plain;h=0527e119b3fe84460a6112648329b373135422d5;p=lhc%2Fweb%2Fwiklou.git 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. --- 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); }