Changeset 28721
- Timestamp:
- 06/10/2014 02:42:35 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r28719 r28721 88 88 // Pattern-based replacements of characters. 89 89 $dynamic = array(); 90 91 // Quoted Numbers like "42" or '42.00' 92 if ( '"' !== $opening_quote && '"' !== $closing_quote ) { 93 $dynamic[ '/(?<=\A|' . $spaces . ')"(\d[\d\.\,]*)"/' ] = $opening_quote . '$1' . $closing_quote; 94 } 95 if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) { 96 $dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[\d\.\,]*)\'/' ] = $opening_single_quote . '$1' . $closing_single_quote; 97 } 90 98 91 99 // '99 '99s '99's (apostrophe) -
trunk/tests/phpunit/tests/formatting/WPTexturize.php
r28719 r28721 155 155 $this->assertEquals('“12345”', wptexturize('"12345"')); 156 156 $this->assertEquals('‘12345’', wptexturize('\'12345\'')); 157 $this->assertEquals('“a 9′ plus a ‘9’, maybe a 9′ ‘9’ ”', wptexturize('"a 9\' plus a \'9\', maybe a 9\' \'9\'"'));158 $this->assertEquals('<p>̵ 6;99<br />‘123’<br />’tis<br />‘s’</p>', wptexturize('<p>\'99<br />\'123\'<br />\'tis<br />\'s\'</p>'));157 $this->assertEquals('“a 9′ plus a ‘9’, maybe a 9′ ‘9’”', wptexturize('"a 9\' plus a \'9\', maybe a 9\' \'9\'"')); 158 $this->assertEquals('<p>’99<br />‘123’<br />’tis<br />‘s’</p>', wptexturize('<p>\'99<br />\'123\'<br />\'tis<br />\'s\'</p>')); 159 159 } 160 160 … … 314 314 ), 315 315 array( 316 "word '99's word", // Due to the logic error, second apos becomes a prime. See ticket #22823317 "word ’99′s word",318 ),319 array(320 "word '99'samsonite",321 "word ’99′samsonite",322 ),323 array(324 316 "according to our source, '33% of all students scored less than 50' on the test.", // Apostrophes and primes have priority over quotes 325 317 "according to our source, ’33% of all students scored less than 50′ on the test.", 326 318 ), 327 array(328 "word '99' word", // See ticket #8775329 "word ’99′ word",330 ),331 319 ); 332 320 } … … 1027 1015 ); 1028 1016 } 1017 1018 /** 1019 * Numbers inside of matching quotes get curly quotes instead of apostrophes and primes. 1020 * 1021 * @ticket 8775 1022 * @dataProvider data_quoted_numbers 1023 */ 1024 function test_quoted_numbers( $input, $output ) { 1025 return $this->assertEquals( $output, wptexturize( $input ) ); 1026 } 1027 1028 function data_quoted_numbers() { 1029 return array( 1030 array( 1031 'word "42.00" word', 1032 'word “42.00” word', 1033 ), 1034 array( 1035 'word "42.00"word', 1036 'word “42.00”word', 1037 ), 1038 array( 1039 "word '42.00' word", 1040 "word ‘42.00’ word", 1041 ), 1042 array( 1043 "word '42.00'word", 1044 "word ‘42.00’word", 1045 ), 1046 array( 1047 'word "42" word', 1048 'word “42” word', 1049 ), 1050 array( 1051 'word "42,00" word', 1052 'word “42,00” word', 1053 ), 1054 array( 1055 'word "4,242.00" word', 1056 'word “4,242.00” word', 1057 ), 1058 array( 1059 "word '99's word", // Is this correct? 1060 "word ‘99’s word", 1061 ), 1062 array( 1063 "word '99'samsonite", 1064 "word ‘99’samsonite", 1065 ), 1066 ); 1067 } 1068 1029 1069 }
Note: See TracChangeset
for help on using the changeset viewer.