r29950 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r29949‎ | r29950 | r29951 >
Date:13:53, 19 January 2008
Author:tstarling
Status:old
Tags:
Comment:
Fix for more than 6 equals signs on their own line.
Modified paths:
  • /trunk/phase3/includes/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Parser.php
@@ -2906,16 +2906,16 @@
29072907 // Do this using the reversed string since the other solutions (end anchor, etc.) are inefficient
29082908 $m = false;
29092909 $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 ) ) {
29112911 if ( $i - strlen( $m[0] ) == $piece->startPos ) {
29122912 // This is just a single string of equals signs on its own line
29132913 // 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] );
29142916 if ( $count < 3 ) {
29152917 $count = 0;
2916 - } elseif ( $count % 2 ) {
2917 - $count = ( $count - 1 ) / 2;
29182918 } else {
2919 - $count = $count / 2 - 1;
 2919+ $count = min( 6, intval( ( $count - 1 ) / 2 ) );
29202920 }
29212921 } else {
29222922 $count = min( strlen( $m[1] ), $count );

Follow-up revisions

RevisionCommit summaryAuthorDate
r30022Postcard from linuxland....tstarling16:36, 21 January 2008

Status & tagging log