From: Tim Starling Date: Sat, 19 Jan 2008 13:53:09 +0000 (+0000) Subject: Fix for more than 6 equals signs on their own line. X-Git-Tag: 1.31.0-rc.0~49907 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22calendrier%22%2C%22type=semaine%22%29%20.%20%22?a=commitdiff_plain;h=3e6f914894a574e8c445f4c8ab4c5b7fe5624d27;p=lhc%2Fweb%2Fwiklou.git Fix for more than 6 equals signs on their own line. --- diff --git a/includes/Parser.php b/includes/Parser.php index 037c93bc5e..1a61924b69 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -2906,16 +2906,16 @@ class Parser // Do this using the reversed string since the other solutions (end anchor, etc.) are inefficient $m = false; $count = $piece->count; - if ( preg_match( "/\s*(={{$count}})/A", $revText, $m, 0, strlen( $text ) - $i ) ) { + if ( preg_match( "/\s*(=+)/A", $revText, $m, 0, strlen( $text ) - $i ) ) { if ( $i - strlen( $m[0] ) == $piece->startPos ) { // This is just a single string of equals signs on its own line // Replicate the doHeadings behaviour /={count}(.+)={count}/ + // First find out how many equals signs there really are (don't stop at 6) + $count = strlen( $m[1] ); if ( $count < 3 ) { $count = 0; - } elseif ( $count % 2 ) { - $count = ( $count - 1 ) / 2; } else { - $count = $count / 2 - 1; + $count = min( 6, intval( ( $count - 1 ) / 2 ) ); } } else { $count = min( strlen( $m[1] ), $count );