Index: trunk/phase3/includes/Parser.php |
— | — | @@ -2906,16 +2906,16 @@ |
2907 | 2907 | // Do this using the reversed string since the other solutions (end anchor, etc.) are inefficient |
2908 | 2908 | $m = false; |
2909 | 2909 | $count = $piece->count; |
2910 | | - if ( preg_match( "/\s*(={{$count}})/A", $revText, $m, 0, strlen( $text ) - $i ) ) { |
| 2910 | + if ( preg_match( "/\s*(=+)/A", $revText, $m, 0, strlen( $text ) - $i ) ) { |
2911 | 2911 | if ( $i - strlen( $m[0] ) == $piece->startPos ) { |
2912 | 2912 | // This is just a single string of equals signs on its own line |
2913 | 2913 | // Replicate the doHeadings behaviour /={count}(.+)={count}/ |
| 2914 | + // First find out how many equals signs there really are (don't stop at 6) |
| 2915 | + $count = strlen( $m[1] ); |
2914 | 2916 | if ( $count < 3 ) { |
2915 | 2917 | $count = 0; |
2916 | | - } elseif ( $count % 2 ) { |
2917 | | - $count = ( $count - 1 ) / 2; |
2918 | 2918 | } else { |
2919 | | - $count = $count / 2 - 1; |
| 2919 | + $count = min( 6, intval( ( $count - 1 ) / 2 ) ); |
2920 | 2920 | } |
2921 | 2921 | } else { |
2922 | 2922 | $count = min( strlen( $m[1] ), $count ); |