Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -1112,7 +1112,13 @@ |
1113 | 1113 | * Helper function for doAllQuotes() |
1114 | 1114 | */ |
1115 | 1115 | 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 | + |
1117 | 1123 | if ( count( $arr ) == 1 ) |
1118 | 1124 | return $text; |
1119 | 1125 | else |
— | — | @@ -1127,20 +1133,6 @@ |
1128 | 1134 | { |
1129 | 1135 | if ( ( $i % 2 ) == 1 ) |
1130 | 1136 | { |
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 | | - } |
1145 | 1137 | # Count the number of occurrences of bold and italics mark-ups. |
1146 | 1138 | if ( strlen( $arr[$i] ) == 2 ) { $numitalics++; } |
1147 | 1139 | elseif ( strlen( $arr[$i] ) == 3 ) { $numbold++; } |