Changeset 28761
- Timestamp:
- 06/17/2014 05:40:07 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r28727 r28761 101 101 $dynamic = array(); 102 102 103 // '99' is an ambiguous case among other patterns; assume it's an abbreviated year at the end of a quotation. 104 if ( "'" !== $apos && "'" !== $closing_single_quote ) { 105 $dynamic[ '/\'(\d\d)\'(?=\Z|[.,)}>\-\]]|' . $spaces . ')/' ] = $apos . '$1' . $closing_single_quote; 106 } 107 108 // '99 '99s '99's (apostrophe) But never '9 or '999 or '99.0. 109 if ( "'" !== $apos ) { 110 $dynamic[ '/\'(?=\d\d(?:\Z|(?!\d|[.,]\d)))/' ] = $apos; 111 } 112 103 113 // Quoted Numbers like "42" or '42.00' 104 114 if ( '"' !== $opening_quote && '"' !== $closing_quote ) { … … 107 117 if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) { 108 118 $dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[\d\.\,]*)\'/' ] = $opening_single_quote . '$1' . $closing_single_quote; 109 }110 111 // '99 '99s '99's (apostrophe)112 if ( "'" !== $apos ) {113 $dynamic[ '/\'(?=\d)/' ] = $apos;114 119 } 115 120 -
trunk/tests/phpunit/tests/formatting/WPTexturize.php
r28727 r28761 1280 1280 ); 1281 1281 } 1282 1283 /** 1284 * Year abbreviations consist of exactly two digits. 1285 * 1286 * @ticket 26850 1287 * @dataProvider data_quotes_and_dashes 1288 */ 1289 function test_year_abbr( $input, $output ) { 1290 return $this->assertEquals( $output, wptexturize( $input ) ); 1291 } 1292 1293 function data_year_abbr() { 1294 return array( 1295 array( 1296 "word '99 word", 1297 "word ’99 word", 1298 ), 1299 array( 1300 "word '99. word", 1301 "word ’99. word", 1302 ), 1303 array( 1304 "word '99, word", 1305 "word ’99, word", 1306 ), 1307 array( 1308 "word '99; word", 1309 "word ’99; word", 1310 ), 1311 array( 1312 "word '99' word", // For this pattern, prime doesn't make sense. Should get apos and a closing quote. 1313 "word ’99’ word", 1314 ), 1315 array( 1316 "word '99'. word", 1317 "word ’99’. word", 1318 ), 1319 array( 1320 "word '99', word", 1321 "word ’99’, word", 1322 ), 1323 array( 1324 "word '99.' word", 1325 "word ’99.’ word", 1326 ), 1327 array( 1328 "word '99", 1329 "word ’99", 1330 ), 1331 array( 1332 "'99 word", 1333 "’99 word", 1334 ), 1335 array( 1336 "word '999 word", // Does not match the apos pattern, should be opening quote. 1337 "word ‘999 word", 1338 ), 1339 array( 1340 "word '9 word", 1341 "word ‘9 word", 1342 ), 1343 array( 1344 "word '99.9 word", 1345 "word ‘99.9 word", 1346 ), 1347 array( 1348 "word '999", 1349 "word ‘999", 1350 ), 1351 array( 1352 "word '9", 1353 "word ‘9", 1354 ), 1355 array( 1356 "in '4 years, 3 months,' Obama cut the deficit", 1357 "in ‘4 years, 3 months,’ Obama cut the deficit", 1358 ), 1359 array( 1360 "testing's '4' through 'quotes'", 1361 "testing’s ‘4’ through ‘quotes’", 1362 ), 1363 ); 1364 } 1282 1365 }
Note: See TracChangeset
for help on using the changeset viewer.