$text = $this->strip( $text, $x );
$text = $this->internalParse( $text, $linestart );
+
+ $dashReplace = array(
+ '/ - /' => " – ", # N dash
+ '/(?<=[0-9])-(?=[0-9])/' => "–", # N dash between numbers
+ '/ -- /' => " — " # M dash
+ );
+ $text = preg_replace( array_keys($dashReplace), array_values($dashReplace), $text );
+
+
$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)/i' => '\\1 \\2',
+ '/(.) (?=\\?|:|;|!|\\302\\273)/' => '\\1 \\2',
# french spaces, Guillemet-right
- '/(\\302\\253) /i' => '\\1 ',
+ '/(\\302\\253) /' => '\\1 ',
'/<hr *>/i' => '<hr />',
'/<br *>/i' => '<br />',
'/<center *>/i' => '<div class="center">',
} else {
$fixtags = array(
# french spaces, last one Guillemet-left
- '/ (\\?|:|;|!|\\302\\273)/i' => ' \\1',
+ '/ (\\?|:|;|!|\\302\\273)/' => ' \\1',
# french spaces, Guillemet-right
- '/(\\302\\253) /i' => '\\1 ',
+ '/(\\302\\253) /' => '\\1 ',
'/<center *>/i' => '<div class="center">',
'/<\\/center *>/i' => '</div>'
);
$text = $wgContLang->convert($text);
$text = $this->unstripNoWiki( $text, $this->mStripState );
- global $wgUseTidy;
if ($wgUseTidy) {
$text = Parser::tidy($text);
}