*fix bug in non-breaking space regexp
authorGuillaume Blanchard <aoineko_jp@users.mediawiki.org>
Tue, 17 Aug 2004 15:42:42 +0000 (15:42 +0000)
committerGuillaume Blanchard <aoineko_jp@users.mediawiki.org>
Tue, 17 Aug 2004 15:42:42 +0000 (15:42 +0000)
*add non-breaking code for French numbers
*set MAX_INCLUDE_REPEAT to 100 (I'll remove it when I'll update the per page size max)

includes/Parser.php

index 3e26d5b..205b1bf 100644 (file)
@@ -32,7 +32,7 @@
 # the generated page would be proportional to the square of the input size.
 # Hence, we limit the number of inclusions of any given page, thus bringing any
 # attack back to O(N).
-define( "MAX_INCLUDE_REPEAT", 20 );
+define( "MAX_INCLUDE_REPEAT", 100 );
 define( "MAX_INCLUDE_SIZE", 1000000 ); // 1 Million
 
 # Allowed values for $mOutputType
@@ -128,9 +128,10 @@ class Parser
                        $fixtags = array(
                                # french spaces, last one Guillemet-left
                                # only if there is something before the space
-                               '/(.) (\\?|:|;|!|\\302\\273)/i' => '\\1&nbsp;\\2',
+                               '/ (?=\\?|:|;|!|\\302\\273)/' => '&nbsp;\\1',
+                               '/(\d) (?=\d{3}\D)/' => '\\1&nbsp;\\2',
                                # french spaces, Guillemet-right
-                               "/(\\302\\253) /i"=>"\\1&nbsp;",
+                               "/(\\302\\253) /"=>"\\1&nbsp;",
                                '/<hr *>/i' => '<hr />',
                                '/<br *>/i' => '<br />',
                                '/<center *>/i' => '<div class="center">',
@@ -143,9 +144,10 @@ class Parser
                } else {
                        $fixtags = array(
                                # french spaces, last one Guillemet-left
-                               '/ (\\?|:|;|!|\\302\\273)/i' => '&nbsp;\\1',
+                               '/ (?=\\?|:|;|!|\\302\\273)/' => '&nbsp;\\1',
+                               '/(\d) (?=\d{3}\D)/' => '\\1&nbsp;\\2',
                                # french spaces, Guillemet-right
-                               '/(\\302\\253) /i' => '\\1&nbsp;',
+                               '/(\\302\\253) /' => '\\1&nbsp;',
                                '/([^> ]+(&#x30(1|3|9);)[^< ]*)/i' => '<span class="diacrit">\\1</span>',
                                '/<center *>/i' => '<div class="center">',
                                '/<\\/center *>/i' => '</div>'