r61525 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61524‎ | r61525 | r61526 >
Date:18:55, 26 January 2010
Author:platonides
Status:reverted
Tags:
Comment:
Step 1: Apply attachment 2 from bug 18765.
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/parser/Parser.php
@@ -1112,7 +1112,13 @@
11131113 * Helper function for doAllQuotes()
11141114 */
11151115 public function doQuotes( $text ) {
1116 - $arr = preg_split( "/(''+)/", $text, -1, PREG_SPLIT_DELIM_CAPTURE );
 1116+ # Split in groups of 2, 3, 5 or 6 apostrophes.
 1117+ # If there are ever four apostrophes, assume the first is supposed to
 1118+ # be text, and the remaining three constitute mark-up for bold text.
 1119+ # If there are more than 6 apostrophes in a row, assume they're all
 1120+ # text except for the last 6.
 1121+ $arr = preg_split( "/('{2,3}(?:''')?)(?!')/", $text, -1, PREG_SPLIT_DELIM_CAPTURE );
 1122+
11171123 if ( count( $arr ) == 1 )
11181124 return $text;
11191125 else
@@ -1127,20 +1133,6 @@
11281134 {
11291135 if ( ( $i % 2 ) == 1 )
11301136 {
1131 - # If there are ever four apostrophes, assume the first is supposed to
1132 - # be text, and the remaining three constitute mark-up for bold text.
1133 - if ( strlen( $arr[$i] ) == 4 )
1134 - {
1135 - $arr[$i-1] .= "'";
1136 - $arr[$i] = "'''";
1137 - }
1138 - # If there are more than 6 apostrophes in a row, assume they're all
1139 - # text except for the last 6.
1140 - elseif ( strlen( $arr[$i] ) > 6 )
1141 - {
1142 - $arr[$i-1] .= str_repeat( "'", strlen( $arr[$i] ) - 6 );
1143 - $arr[$i] = "''''''";
1144 - }
11451137 # Count the number of occurrences of bold and italics mark-ups.
11461138 if ( strlen( $arr[$i] ) == 2 ) { $numitalics++; }
11471139 elseif ( strlen( $arr[$i] ) == 3 ) { $numbold++; }

Follow-up revisions

RevisionCommit summaryAuthorDate
r61551Revert r61528, r61527, r61526, r61525, r61519, r61515, r61053, r61052 (Parser...tstarling02:41, 27 January 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61052* (bug 18765) Increased consistency of bold-italic markup for unbalanced quotes....platonides16:18, 14 January 2010

Status & tagging log