Changeset 42343 for trunk/tests/phpunit/tests/formatting/WPTexturize.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/WPTexturize.php
r36578 r42343 6 6 class Tests_Formatting_WPTexturize extends WP_UnitTestCase { 7 7 function test_dashes() { 8 $this->assertEquals( 'Hey — boo?', wptexturize('Hey -- boo?'));9 $this->assertEquals( '<a href="http://xx--xx">Hey — boo?</a>', wptexturize('<a href="http://xx--xx">Hey -- boo?</a>'));8 $this->assertEquals( 'Hey — boo?', wptexturize( 'Hey -- boo?' ) ); 9 $this->assertEquals( '<a href="http://xx--xx">Hey — boo?</a>', wptexturize( '<a href="http://xx--xx">Hey -- boo?</a>' ) ); 10 10 } 11 11 12 12 function test_disable() { 13 $this->assertEquals( '<pre>---&</pre>', wptexturize('<pre>---&</pre>'));14 $this->assertEquals( '<pre><code></code>--&</pre>', wptexturize('<pre><code></code>--&</pre>'));15 16 $this->assertEquals( '<code>---&</code>', wptexturize( '<code>---&</code>') );17 $this->assertEquals( '<kbd>---&</kbd>', wptexturize( '<kbd>---&</kbd>') );18 $this->assertEquals( '<style>---&</style>', wptexturize( '<style>---&</style>') );13 $this->assertEquals( '<pre>---&</pre>', wptexturize( '<pre>---&</pre>' ) ); 14 $this->assertEquals( '<pre><code></code>--&</pre>', wptexturize( '<pre><code></code>--&</pre>' ) ); 15 16 $this->assertEquals( '<code>---&</code>', wptexturize( '<code>---&</code>' ) ); 17 $this->assertEquals( '<kbd>---&</kbd>', wptexturize( '<kbd>---&</kbd>' ) ); 18 $this->assertEquals( '<style>---&</style>', wptexturize( '<style>---&</style>' ) ); 19 19 $this->assertEquals( '<script>---&</script>', wptexturize( '<script>---&</script>' ) ); 20 $this->assertEquals( '<tt>---&</tt>', wptexturize( '<tt>---&</tt>') );21 22 $this->assertEquals( '<code>href="baba"</code> “baba”', wptexturize('<code>href="baba"</code> "baba"'));20 $this->assertEquals( '<tt>---&</tt>', wptexturize( '<tt>---&</tt>' ) ); 21 22 $this->assertEquals( '<code>href="baba"</code> “baba”', wptexturize( '<code>href="baba"</code> "baba"' ) ); 23 23 24 24 $enabled_tags_inside_code = '<code>curl -s <a href="http://x/">baba</a> | grep sfive | cut -d "\"" -f 10 > topmp3.txt</code>'; 25 $this->assertEquals( $enabled_tags_inside_code, wptexturize($enabled_tags_inside_code));25 $this->assertEquals( $enabled_tags_inside_code, wptexturize( $enabled_tags_inside_code ) ); 26 26 27 27 $double_nest = '<pre>"baba"<code>"baba"<pre></pre></code>"baba"</pre>'; 28 $this->assertEquals( $double_nest, wptexturize($double_nest));28 $this->assertEquals( $double_nest, wptexturize( $double_nest ) ); 29 29 30 30 $invalid_nest = '<pre></code>"baba"</pre>'; 31 $this->assertEquals( $invalid_nest, wptexturize($invalid_nest));31 $this->assertEquals( $invalid_nest, wptexturize( $invalid_nest ) ); 32 32 33 33 } … … 35 35 //WP Ticket #1418 36 36 function test_bracketed_quotes_1418() { 37 $this->assertEquals( '(“test”)', wptexturize('("test")'));38 $this->assertEquals( '(‘test’)', wptexturize("('test')"));39 $this->assertEquals( '(’twas)', wptexturize("('twas)"));37 $this->assertEquals( '(“test”)', wptexturize( '("test")' ) ); 38 $this->assertEquals( '(‘test’)', wptexturize( "('test')" ) ); 39 $this->assertEquals( '(’twas)', wptexturize( "('twas)" ) ); 40 40 } 41 41 42 42 //WP Ticket #3810 43 43 function test_bracketed_quotes_3810() { 44 $this->assertEquals( 'A dog (“Hubertus”) was sent out.', wptexturize('A dog ("Hubertus") was sent out.'));44 $this->assertEquals( 'A dog (“Hubertus”) was sent out.', wptexturize( 'A dog ("Hubertus") was sent out.' ) ); 45 45 } 46 46 47 47 //WP Ticket #4539 48 48 function test_basic_quotes() { 49 $this->assertEquals( 'test’s', wptexturize('test\'s'));50 51 $this->assertEquals( '‘quoted’', wptexturize('\'quoted\''));52 $this->assertEquals( '“quoted”', wptexturize('"quoted"'));53 54 $this->assertEquals( 'space before ‘quoted’ space after', wptexturize('space before \'quoted\' space after'));55 $this->assertEquals( 'space before “quoted” space after', wptexturize('space before "quoted" space after'));56 57 $this->assertEquals( '(‘quoted’)', wptexturize('(\'quoted\')'));58 $this->assertEquals( '{“quoted”}', wptexturize('{"quoted"}'));59 60 $this->assertEquals( '‘qu(ot)ed’', wptexturize('\'qu(ot)ed\''));61 $this->assertEquals( '“qu{ot}ed”', wptexturize('"qu{ot}ed"'));62 63 $this->assertEquals( ' ‘test’s quoted’ ', wptexturize(' \'test\'s quoted\' '));64 $this->assertEquals( ' “test’s quoted” ', wptexturize(' "test\'s quoted" '));49 $this->assertEquals( 'test’s', wptexturize( 'test\'s' ) ); 50 51 $this->assertEquals( '‘quoted’', wptexturize( '\'quoted\'' ) ); 52 $this->assertEquals( '“quoted”', wptexturize( '"quoted"' ) ); 53 54 $this->assertEquals( 'space before ‘quoted’ space after', wptexturize( 'space before \'quoted\' space after' ) ); 55 $this->assertEquals( 'space before “quoted” space after', wptexturize( 'space before "quoted" space after' ) ); 56 57 $this->assertEquals( '(‘quoted’)', wptexturize( '(\'quoted\')' ) ); 58 $this->assertEquals( '{“quoted”}', wptexturize( '{"quoted"}' ) ); 59 60 $this->assertEquals( '‘qu(ot)ed’', wptexturize( '\'qu(ot)ed\'' ) ); 61 $this->assertEquals( '“qu{ot}ed”', wptexturize( '"qu{ot}ed"' ) ); 62 63 $this->assertEquals( ' ‘test’s quoted’ ', wptexturize( ' \'test\'s quoted\' ' ) ); 64 $this->assertEquals( ' “test’s quoted” ', wptexturize( ' "test\'s quoted" ' ) ); 65 65 } 66 66 … … 72 72 $this->assertEquals( 73 73 'That means every moment you’re working on something without it being in the public it’s actually dying.', 74 wptexturize( "That means every moment you're working on something without it being in the public it's actually dying.")74 wptexturize( "That means every moment you're working on something without it being in the public it's actually dying." ) 75 75 ); 76 76 } … … 80 80 */ 81 81 function test_quotes() { 82 $this->assertEquals( '“Quoted String”', wptexturize('"Quoted String"'));82 $this->assertEquals( '“Quoted String”', wptexturize( '"Quoted String"' ) ); 83 83 //$this->assertEquals('Here is “<a href="http://example.com">a test with a link</a>”', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"')); 84 84 //$this->assertEquals('Here is “<a href="http://example.com">a test with a link and a period</a>”.', wptexturize('Here is "<a href="http://example.com">a test with a link and a period</a>".')); 85 $this->assertEquals( 'Here is “<a href="http://example.com">a test with a link</a>” and a space.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>" and a space.'));86 $this->assertEquals( 'Here is “<a href="http://example.com">a test with a link</a> and some text quoted”', wptexturize('Here is "<a href="http://example.com">a test with a link</a> and some text quoted"'));85 $this->assertEquals( 'Here is “<a href="http://example.com">a test with a link</a>” and a space.', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a>" and a space.' ) ); 86 $this->assertEquals( 'Here is “<a href="http://example.com">a test with a link</a> and some text quoted”', wptexturize( 'Here is "<a href="http://example.com">a test with a link</a> and some text quoted"' ) ); 87 87 //$this->assertEquals('Here is “<a href="http://example.com">a test with a link</a>”, and a comma.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>", and a comma.')); 88 88 //$this->assertEquals('Here is “<a href="http://example.com">a test with a link</a>”; and a semi-colon.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"; and a semi-colon.')); … … 91 91 //$this->assertEquals('Here is “a test <a href="http://example.com">with a link</a>”.', wptexturize('Here is "a test <a href="http://example.com">with a link</a>".')); 92 92 //$this->assertEquals('Here is “<a href="http://example.com">a test with a link</a>”and a work stuck to the end.', wptexturize('Here is "<a href="http://example.com">a test with a link</a>"and a work stuck to the end.')); 93 $this->assertEquals( 'A test with a finishing number, “like 23”.', wptexturize('A test with a finishing number, "like 23".'));94 $this->assertEquals( 'A test with a number, “like 62”, is nice to have.', wptexturize('A test with a number, "like 62", is nice to have.'));93 $this->assertEquals( 'A test with a finishing number, “like 23”.', wptexturize( 'A test with a finishing number, "like 23".' ) ); 94 $this->assertEquals( 'A test with a number, “like 62”, is nice to have.', wptexturize( 'A test with a number, "like 62", is nice to have.' ) ); 95 95 } 96 96 … … 99 99 */ 100 100 function test_quotes_before_s() { 101 $this->assertEquals( 'test’s', wptexturize("test's"));102 $this->assertEquals( '‘test’s', wptexturize("'test's"));103 $this->assertEquals( '‘test’s’', wptexturize("'test's'"));104 $this->assertEquals( '‘string’', wptexturize("'string'"));105 $this->assertEquals( '‘string’s’', wptexturize("'string's'"));101 $this->assertEquals( 'test’s', wptexturize( "test's" ) ); 102 $this->assertEquals( '‘test’s', wptexturize( "'test's" ) ); 103 $this->assertEquals( '‘test’s’', wptexturize( "'test's'" ) ); 104 $this->assertEquals( '‘string’', wptexturize( "'string'" ) ); 105 $this->assertEquals( '‘string’s’', wptexturize( "'string's'" ) ); 106 106 } 107 107 … … 110 110 */ 111 111 function test_quotes_before_numbers() { 112 $this->assertEquals( 'Class of ’99', wptexturize("Class of '99"));113 $this->assertEquals( 'Class of ’99’s', wptexturize("Class of '99's"));114 $this->assertEquals( '‘Class of ’99’', wptexturize("'Class of '99'"));115 $this->assertEquals( '‘Class of ’99’ ', wptexturize("'Class of '99' "));116 $this->assertEquals( '‘Class of ’99’.', wptexturize("'Class of '99'."));117 $this->assertEquals( '‘Class of ’99’, she said', wptexturize("'Class of '99', she said"));118 $this->assertEquals( '‘Class of ’99’:', wptexturize("'Class of '99':"));119 $this->assertEquals( '‘Class of ’99’;', wptexturize("'Class of '99';"));120 $this->assertEquals( '‘Class of ’99’!', wptexturize("'Class of '99'!"));121 $this->assertEquals( '‘Class of ’99’?', wptexturize("'Class of '99'?"));122 $this->assertEquals( '‘Class of ’99’s’', wptexturize("'Class of '99's'"));123 $this->assertEquals( '‘Class of ’99’s’', wptexturize("'Class of '99’s'"));124 $this->assertEquals( '“Class of 99”', wptexturize("\"Class of 99\""));125 $this->assertEquals( '“Class of ’99”', wptexturize("\"Class of '99\""));126 $this->assertEquals( '{“Class of ’99”}', wptexturize("{\"Class of '99\"}"));127 $this->assertEquals( ' “Class of ’99” ', wptexturize(" \"Class of '99\" "));128 $this->assertEquals( ' “Class of ’99”.', wptexturize(" \"Class of '99\"."));129 $this->assertEquals( ' “Class of ’99”, she said', wptexturize(" \"Class of '99\", she said"));130 $this->assertEquals( ' “Class of ’99”:', wptexturize(" \"Class of '99\":"));131 $this->assertEquals( ' “Class of ’99”;', wptexturize(" \"Class of '99\";"));132 $this->assertEquals( ' “Class of ’99”!', wptexturize(" \"Class of '99\"!"));133 $this->assertEquals( ' “Class of ’99”?', wptexturize(" \"Class of '99\"?"));134 $this->assertEquals( '}”Class of ’99″{', wptexturize("}\"Class of '99\"{")); // Not a quotation, may be between two other quotations.112 $this->assertEquals( 'Class of ’99', wptexturize( "Class of '99" ) ); 113 $this->assertEquals( 'Class of ’99’s', wptexturize( "Class of '99's" ) ); 114 $this->assertEquals( '‘Class of ’99’', wptexturize( "'Class of '99'" ) ); 115 $this->assertEquals( '‘Class of ’99’ ', wptexturize( "'Class of '99' " ) ); 116 $this->assertEquals( '‘Class of ’99’.', wptexturize( "'Class of '99'." ) ); 117 $this->assertEquals( '‘Class of ’99’, she said', wptexturize( "'Class of '99', she said" ) ); 118 $this->assertEquals( '‘Class of ’99’:', wptexturize( "'Class of '99':" ) ); 119 $this->assertEquals( '‘Class of ’99’;', wptexturize( "'Class of '99';" ) ); 120 $this->assertEquals( '‘Class of ’99’!', wptexturize( "'Class of '99'!" ) ); 121 $this->assertEquals( '‘Class of ’99’?', wptexturize( "'Class of '99'?" ) ); 122 $this->assertEquals( '‘Class of ’99’s’', wptexturize( "'Class of '99's'" ) ); 123 $this->assertEquals( '‘Class of ’99’s’', wptexturize( "'Class of '99’s'" ) ); 124 $this->assertEquals( '“Class of 99”', wptexturize( '"Class of 99"' ) ); 125 $this->assertEquals( '“Class of ’99”', wptexturize( "\"Class of '99\"" ) ); 126 $this->assertEquals( '{“Class of ’99”}', wptexturize( "{\"Class of '99\"}" ) ); 127 $this->assertEquals( ' “Class of ’99” ', wptexturize( " \"Class of '99\" " ) ); 128 $this->assertEquals( ' “Class of ’99”.', wptexturize( " \"Class of '99\"." ) ); 129 $this->assertEquals( ' “Class of ’99”, she said', wptexturize( " \"Class of '99\", she said" ) ); 130 $this->assertEquals( ' “Class of ’99”:', wptexturize( " \"Class of '99\":" ) ); 131 $this->assertEquals( ' “Class of ’99”;', wptexturize( " \"Class of '99\";" ) ); 132 $this->assertEquals( ' “Class of ’99”!', wptexturize( " \"Class of '99\"!" ) ); 133 $this->assertEquals( ' “Class of ’99”?', wptexturize( " \"Class of '99\"?" ) ); 134 $this->assertEquals( '}”Class of ’99″{', wptexturize( "}\"Class of '99\"{" ) ); // Not a quotation, may be between two other quotations. 135 135 } 136 136 137 137 function test_quotes_after_numbers() { 138 $this->assertEquals( 'Class of ’99', wptexturize("Class of '99"));138 $this->assertEquals( 'Class of ’99', wptexturize( "Class of '99" ) ); 139 139 } 140 140 … … 144 144 */ 145 145 function test_other_html() { 146 $this->assertEquals( '‘<strong>', wptexturize("'<strong>"));146 $this->assertEquals( '‘<strong>', wptexturize( "'<strong>" ) ); 147 147 //$this->assertEquals('‘<strong>Quoted Text</strong>’,', wptexturize("'<strong>Quoted Text</strong>',")); 148 148 //$this->assertEquals('“<strong>Quoted Text</strong>”,', wptexturize('"<strong>Quoted Text</strong>",')); … … 150 150 151 151 function test_x() { 152 $this->assertEquals( '14×24', wptexturize("14x24"));152 $this->assertEquals( '14×24', wptexturize( '14x24' ) ); 153 153 } 154 154 155 155 function test_minutes_seconds() { 156 $this->assertEquals( '9′', wptexturize('9\''));157 $this->assertEquals( '9″', wptexturize("9\""));158 159 $this->assertEquals( 'a 9′ b', wptexturize('a 9\' b'));160 $this->assertEquals( 'a 9″ b', wptexturize("a 9\" b"));161 162 $this->assertEquals( '“a 9′ b”', wptexturize('"a 9\' b"'));163 $this->assertEquals( '‘a 9″ b’', wptexturize("'a 9\" b'"));156 $this->assertEquals( '9′', wptexturize( '9\'' ) ); 157 $this->assertEquals( '9″', wptexturize( '9"' ) ); 158 159 $this->assertEquals( 'a 9′ b', wptexturize( 'a 9\' b' ) ); 160 $this->assertEquals( 'a 9″ b', wptexturize( 'a 9" b' ) ); 161 162 $this->assertEquals( '“a 9′ b”', wptexturize( '"a 9\' b"' ) ); 163 $this->assertEquals( '‘a 9″ b’', wptexturize( "'a 9\" b'" ) ); 164 164 } 165 165 … … 168 168 */ 169 169 function test_wptexturize_quotes_around_numbers() { 170 $this->assertEquals( '“12345”', wptexturize('"12345"'));171 $this->assertEquals( '‘12345’', wptexturize('\'12345\''));172 $this->assertEquals( '“a 9′ plus a ‘9’, maybe a 9′ ‘9’”', wptexturize('"a 9\' plus a \'9\', maybe a 9\' \'9\'"'));173 $this->assertEquals( '<p>’99<br />‘123’<br />’tis<br />‘s’</p>', wptexturize('<p>\'99<br />\'123\'<br />\'tis<br />\'s\'</p>'));170 $this->assertEquals( '“12345”', wptexturize( '"12345"' ) ); 171 $this->assertEquals( '‘12345’', wptexturize( '\'12345\'' ) ); 172 $this->assertEquals( '“a 9′ plus a ‘9’, maybe a 9′ ‘9’”', wptexturize( '"a 9\' plus a \'9\', maybe a 9\' \'9\'"' ) ); 173 $this->assertEquals( '<p>’99<br />‘123’<br />’tis<br />‘s’</p>', wptexturize( '<p>\'99<br />\'123\'<br />\'tis<br />\'s\'</p>' ) ); 174 174 } 175 175 … … 178 178 */ 179 179 function test_wptexturize_html_comments() { 180 $this->assertEquals( '<!--[if !IE]>--><!--<![endif]-->', wptexturize('<!--[if !IE]>--><!--<![endif]-->'));181 $this->assertEquals( '<!--[if !IE]>"a 9\' plus a \'9\', maybe a 9\' \'9\' "<![endif]-->', wptexturize('<!--[if !IE]>"a 9\' plus a \'9\', maybe a 9\' \'9\' "<![endif]-->'));182 $this->assertEquals( '<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>', wptexturize('<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>'));180 $this->assertEquals( '<!--[if !IE]>--><!--<![endif]-->', wptexturize( '<!--[if !IE]>--><!--<![endif]-->' ) ); 181 $this->assertEquals( '<!--[if !IE]>"a 9\' plus a \'9\', maybe a 9\' \'9\' "<![endif]-->', wptexturize( '<!--[if !IE]>"a 9\' plus a \'9\', maybe a 9\' \'9\' "<![endif]-->' ) ); 182 $this->assertEquals( '<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>', wptexturize( '<ul><li>Hello.</li><!--<li>Goodbye.</li>--></ul>' ) ); 183 183 } 184 184 … … 188 188 */ 189 189 function test_entity_quote_cuddling() { 190 $this->assertEquals( ' “Testing”', wptexturize(' "Testing"'));190 $this->assertEquals( ' “Testing”', wptexturize( ' "Testing"' ) ); 191 191 //$this->assertEquals('&“Testing”', wptexturize('&"Testing"')); 192 192 } … … 208 208 $this->assertEquals( ' – ', wptexturize( ' - ' ) ); 209 209 $this->assertEquals( ' – ', wptexturize( ' - ' ) ); 210 $this->assertEquals( ' – ', wptexturize( ' - ' ) );210 $this->assertEquals( ' – ', wptexturize( ' - ' ) ); 211 211 $this->assertEquals( "$nbsp–$nbsp", wptexturize( "$nbsp-$nbsp" ) ); 212 212 $this->assertEquals( " –$nbsp", wptexturize( " -$nbsp" ) ); 213 $this->assertEquals( "$nbsp– ", wptexturize( "$nbsp- " ) );213 $this->assertEquals( "$nbsp– ", wptexturize( "$nbsp- " ) ); 214 214 215 215 $this->assertEquals( ' — ', wptexturize( ' -- ' ) ); 216 216 $this->assertEquals( ' — ', wptexturize( ' -- ' ) ); 217 217 $this->assertEquals( ' — ', wptexturize( ' -- ' ) ); 218 $this->assertEquals( ' — ', wptexturize( ' -- ' ) );218 $this->assertEquals( ' — ', wptexturize( ' -- ' ) ); 219 219 $this->assertEquals( "$nbsp—$nbsp", wptexturize( "$nbsp--$nbsp" ) ); 220 220 $this->assertEquals( " —$nbsp", wptexturize( " --$nbsp" ) ); 221 $this->assertEquals( "$nbsp— ", wptexturize( "$nbsp-- " ) );221 $this->assertEquals( "$nbsp— ", wptexturize( "$nbsp-- " ) ); 222 222 } 223 223 … … 285 285 ), 286 286 array( 287 "stop. \"A quote after 2 spaces.\"",288 "stop. “A quote after 2 spaces.”",289 ), 290 array( 291 "stop. \"A quote after 2 spaces.\"",292 "stop. “A quote after 2 spaces.”",287 'stop. "A quote after 2 spaces."', 288 'stop. “A quote after 2 spaces.”', 289 ), 290 array( 291 'stop. "A quote after 2 spaces."', 292 'stop. “A quote after 2 spaces.”', 293 293 ), 294 294 array( 295 295 "stop. 'A quote after 2 spaces.'", 296 "stop. ‘A quote after 2 spaces.’",296 'stop. ‘A quote after 2 spaces.’', 297 297 ), 298 298 array( 299 299 "stop. 'A quote after 2 spaces.'", 300 "stop. ‘A quote after 2 spaces.’",300 'stop. ‘A quote after 2 spaces.’', 301 301 ), 302 302 array( … … 323 323 array( 324 324 "word '99 word", 325 "word ’99 word",325 'word ’99 word', 326 326 ), 327 327 array( 328 328 "word'99 word", 329 "word’99 word",329 'word’99 word', 330 330 ), 331 331 array( 332 332 "word '99word", 333 "word ’99word",333 'word ’99word', 334 334 ), 335 335 array( 336 336 "word'99word", 337 "word’99word",337 'word’99word', 338 338 ), 339 339 array( 340 340 "word '99’s word", // Appears as a separate but logically superfluous pattern in 3.8. 341 "word ’99’s word",341 'word ’99’s word', 342 342 ), 343 343 array( 344 344 "according to our source, '33 students scored less than 50' on the test.", // Apostrophes and primes have priority over quotes 345 "according to our source, ’33 students scored less than 50′ on the test.",345 'according to our source, ’33 students scored less than 50′ on the test.', 346 346 ), 347 347 ); … … 364 364 array( 365 365 "word 'word word", 366 "word ‘word word",366 'word ‘word word', 367 367 ), 368 368 array( 369 369 "word ('word word", 370 "word (‘word word",370 'word (‘word word', 371 371 ), 372 372 array( 373 373 "word ['word word", 374 "word [‘word word",374 'word [‘word word', 375 375 ), 376 376 array( … … 380 380 array( 381 381 "word <'word word", // Valid HTML input makes curly quotes. 382 "word <‘word word",382 'word <‘word word', 383 383 ), 384 384 array( 385 385 "word {'word word", 386 "word {‘word word",386 'word {‘word word', 387 387 ), 388 388 array( 389 389 "word \"'word word", 390 "word “‘word word", // Two opening quotes390 'word “‘word word', // Two opening quotes 391 391 ), 392 392 array( 393 393 "'word word", 394 "‘word word",394 '‘word word', 395 395 ), 396 396 array( 397 397 "word('word word", 398 "word(‘word word",398 'word(‘word word', 399 399 ), 400 400 array( 401 401 "word['word word", 402 "word[‘word word",402 'word[‘word word', 403 403 ), 404 404 array( … … 408 408 array( 409 409 "word<'word word", 410 "word<‘word word",410 'word<‘word word', 411 411 ), 412 412 array( 413 413 "word{'word word", 414 "word{‘word word",414 'word{‘word word', 415 415 ), 416 416 array( 417 417 "word\"'word word", 418 "word”‘word word", // Closing quote, then opening quote418 'word”‘word word', // Closing quote, then opening quote 419 419 ), 420 420 array( 421 421 "word ' word word", 422 "word ‘ word word",422 'word ‘ word word', 423 423 ), 424 424 array( 425 425 "word (' word word", 426 "word (‘ word word",426 'word (‘ word word', 427 427 ), 428 428 array( 429 429 "word [' word word", 430 "word [‘ word word",430 'word [‘ word word', 431 431 ), 432 432 array( … … 436 436 array( 437 437 "word <' word word", 438 "word <‘ word word",438 'word <‘ word word', 439 439 ), 440 440 array( 441 441 "word {' word word", 442 "word {‘ word word",442 'word {‘ word word', 443 443 ), 444 444 array( 445 445 "word \"' word word", 446 "word “‘ word word", // Two opening quotes446 'word “‘ word word', // Two opening quotes 447 447 ), 448 448 array( 449 449 "' word word", 450 "‘ word word",450 '‘ word word', 451 451 ), 452 452 array( 453 453 "word(' word word", 454 "word(‘ word word",454 'word(‘ word word', 455 455 ), 456 456 array( 457 457 "word[' word word", 458 "word[‘ word word",458 'word[‘ word word', 459 459 ), 460 460 array( … … 464 464 array( 465 465 "word<' word word", 466 "word<‘ word word",466 'word<‘ word word', 467 467 ), 468 468 array( 469 469 "word{' word word", 470 "word{‘ word word",470 'word{‘ word word', 471 471 ), 472 472 array( 473 473 "word\"' word word", 474 "word”‘ word word", // Closing quote, then opening quote474 'word”‘ word word', // Closing quote, then opening quote 475 475 ), 476 476 ); … … 526 526 array( 527 527 "word 99' word", 528 "word 99′ word",528 'word 99′ word', 529 529 ), 530 530 array( 531 531 "word 99'word", // Not a prime anymore. Apostrophes get priority. 532 "word 99’word",532 'word 99’word', 533 533 ), 534 534 array( 535 535 "word99' word", 536 "word99′ word",536 'word99′ word', 537 537 ), 538 538 array( 539 539 "word99'word", // Not a prime anymore. 540 "word99’word",540 'word99’word', 541 541 ), 542 542 ); … … 559 559 array( 560 560 "word word's word", 561 "word word’s word",561 'word word’s word', 562 562 ), 563 563 array( … … 579 579 array( 580 580 "word'< word", // Invalid HTML input does trigger the apos pattern. 581 "word’< word",581 'word’< word', 582 582 ), 583 583 ); … … 766 766 array( 767 767 "word word' word", 768 "word word’ word",768 'word word’ word', 769 769 ), 770 770 array( 771 771 "word word'. word", 772 "word word’. word",772 'word word’. word', 773 773 ), 774 774 array( 775 775 "word word'.word", 776 "word word’.word",776 'word word’.word', 777 777 ), 778 778 array( 779 779 "word word', she said", 780 "word word’, she said",780 'word word’, she said', 781 781 ), 782 782 array( 783 783 "word word': word", 784 "word word’: word",784 'word word’: word', 785 785 ), 786 786 array( 787 787 "word word'; word", 788 "word word’; word",788 'word word’; word', 789 789 ), 790 790 array( 791 791 "word word'! word", 792 "word word’! word",792 'word word’! word', 793 793 ), 794 794 array( 795 795 "word word'? word", 796 "word word’? word",796 'word word’? word', 797 797 ), 798 798 array( 799 799 "word word'- word", 800 "word word’- word",800 'word word’- word', 801 801 ), 802 802 array( 803 803 "word word') word", 804 "word word’) word",804 'word word’) word', 805 805 ), 806 806 array( 807 807 "word word'} word", 808 "word word’} word",808 'word word’} word', 809 809 ), 810 810 array( 811 811 "word word'] word", 812 "word word’] word",812 'word word’] word', 813 813 ), 814 814 array( 815 815 "word word'> word", 816 "word word’> word",816 'word word’> word', 817 817 ), 818 818 array( 819 819 "word word'", 820 "word word’",820 'word word’', 821 821 ), 822 822 array( 823 823 "test sentence'.", 824 "test sentence’.",824 'test sentence’.', 825 825 ), 826 826 array( 827 827 "test sentence.'", 828 "test sentence.’",828 'test sentence.’', 829 829 ), 830 830 array( 831 831 "test sentence'. word", 832 "test sentence’. word",832 'test sentence’. word', 833 833 ), 834 834 array( 835 835 "test sentence.' word", 836 "test sentence.’ word",836 'test sentence.’ word', 837 837 ), 838 838 ); … … 854 854 return array( 855 855 array( 856 "9x9",857 "9×9",858 ), 859 array( 860 "12x34",861 "12×34",862 ), 863 array( 864 "-123x1=-123",865 "-123×1=-123",856 '9x9', 857 '9×9', 858 ), 859 array( 860 '12x34', 861 '12×34', 862 ), 863 array( 864 '-123x1=-123', 865 '-123×1=-123', 866 866 ), 867 867 // @ticket 30445 868 868 array( 869 "-123x-1",870 "-123x-1",871 ), 872 array( 873 "0.675x1=0.675",874 "0.675×1=0.675",875 ), 876 array( 877 "9 x 9",878 "9 x 9",879 ), 880 array( 881 "0x70",882 "0x70",883 ), 884 array( 885 "3x2x1x0",886 "3x2x1x0",869 '-123x-1', 870 '-123x-1', 871 ), 872 array( 873 '0.675x1=0.675', 874 '0.675×1=0.675', 875 ), 876 array( 877 '9 x 9', 878 '9 x 9', 879 ), 880 array( 881 '0x70', 882 '0x70', 883 ), 884 array( 885 '3x2x1x0', 886 '3x2x1x0', 887 887 ), 888 888 ); … … 904 904 return array( 905 905 array( 906 "word & word",907 "word & word",908 ), 909 array( 910 "word&word",911 "word&word",912 ), 913 array( 914 "word word",915 "word word",916 ), 917 array( 918 "word & word",919 "word & word",920 ), 921 array( 922 "word ઼ word",923 "word ઼ word",924 ), 925 array( 926 "word Δ word",927 "word Δ word",928 ), 929 array( 930 "word &# word",931 "word &# word",932 ), 933 array( 934 "word &44; word",935 "word &44; word",936 ), 937 array( 938 "word && word",939 "word && word",940 ), 941 array( 942 "word &!amp; word",943 "word &!amp; word",944 ), 945 array( 946 "word &#",947 "word &#",948 ), 949 array( 950 "word &",951 "word &",906 'word & word', 907 'word & word', 908 ), 909 array( 910 'word&word', 911 'word&word', 912 ), 913 array( 914 'word word', 915 'word word', 916 ), 917 array( 918 'word & word', 919 'word & word', 920 ), 921 array( 922 'word ઼ word', 923 'word ઼ word', 924 ), 925 array( 926 'word Δ word', 927 'word Δ word', 928 ), 929 array( 930 'word &# word', 931 'word &# word', 932 ), 933 array( 934 'word &44; word', 935 'word &44; word', 936 ), 937 array( 938 'word && word', 939 'word && word', 940 ), 941 array( 942 'word &!amp; word', 943 'word &!amp; word', 944 ), 945 array( 946 'word &#', 947 'word &#', 948 ), 949 array( 950 'word &', 951 'word &', 952 952 ), 953 953 ); … … 970 970 array( 971 971 "word 'tain't word", 972 "word ’tain’t word",972 'word ’tain’t word', 973 973 ), 974 974 array( 975 975 "word 'twere word", 976 "word ’twere word",976 'word ’twere word', 977 977 ), 978 978 array( 979 979 "word 'twas word", 980 "word ’twas word",980 'word ’twas word', 981 981 ), 982 982 array( 983 983 "word 'tis word", 984 "word ’tis word",984 'word ’tis word', 985 985 ), 986 986 array( 987 987 "word 'twill word", 988 "word ’twill word",988 'word ’twill word', 989 989 ), 990 990 array( 991 991 "word 'til word", 992 "word ’til word",992 'word ’til word', 993 993 ), 994 994 array( 995 995 "word 'bout word", 996 "word ’bout word",996 'word ’bout word', 997 997 ), 998 998 array( 999 999 "word 'nuff word", 1000 "word ’nuff word",1000 'word ’nuff word', 1001 1001 ), 1002 1002 array( 1003 1003 "word 'round word", 1004 "word ’round word",1004 'word ’round word', 1005 1005 ), 1006 1006 array( 1007 1007 "word 'cause word", 1008 "word ’cause word",1008 'word ’cause word', 1009 1009 ), 1010 1010 array( 1011 1011 "word 'em word", 1012 "word ’em word",1012 'word ’em word', 1013 1013 ), 1014 1014 ); … … 1030 1030 return array( 1031 1031 array( 1032 "word --- word",1033 "word — word",1034 ), 1035 array( 1036 "word---word",1037 "word—word",1038 ), 1039 array( 1040 "word -- word",1041 "word — word",1042 ), 1043 array( 1044 "word--word",1045 "word–word",1046 ), 1047 array( 1048 "word - word",1049 "word – word",1050 ), 1051 array( 1052 "word-word",1053 "word-word",1054 ), 1055 array( 1056 "word xn– word",1057 "word xn– word",1058 ), 1059 array( 1060 "wordxn–word",1061 "wordxn–word",1062 ), 1063 array( 1064 "wordxn--word",1065 "wordxn--word",1032 'word --- word', 1033 'word — word', 1034 ), 1035 array( 1036 'word---word', 1037 'word—word', 1038 ), 1039 array( 1040 'word -- word', 1041 'word — word', 1042 ), 1043 array( 1044 'word--word', 1045 'word–word', 1046 ), 1047 array( 1048 'word - word', 1049 'word – word', 1050 ), 1051 array( 1052 'word-word', 1053 'word-word', 1054 ), 1055 array( 1056 'word xn– word', 1057 'word xn– word', 1058 ), 1059 array( 1060 'wordxn–word', 1061 'wordxn–word', 1062 ), 1063 array( 1064 'wordxn--word', 1065 'wordxn--word', 1066 1066 ), 1067 1067 ); … … 1083 1083 return array( 1084 1084 array( 1085 "word ... word",1086 "word … word",1087 ), 1088 array( 1089 "word...word",1090 "word…word",1091 ), 1092 array( 1093 "word `` word",1094 "word “ word",1095 ), 1096 array( 1097 "word``word",1098 "word“word",1085 'word ... word', 1086 'word … word', 1087 ), 1088 array( 1089 'word...word', 1090 'word…word', 1091 ), 1092 array( 1093 'word `` word', 1094 'word “ word', 1095 ), 1096 array( 1097 'word``word', 1098 'word“word', 1099 1099 ), 1100 1100 array( 1101 1101 "word '' word", 1102 "word ” word",1102 'word ” word', 1103 1103 ), 1104 1104 array( 1105 1105 "word''word", 1106 "word”word",1107 ), 1108 array( 1109 "word (tm) word",1110 "word ™ word",1111 ), 1112 array( 1113 "word (tm)word",1114 "word ™word",1115 ), 1116 array( 1117 "word(tm) word",1118 "word(tm) word",1119 ), 1120 array( 1121 "word(tm)word",1122 "word(tm)word",1106 'word”word', 1107 ), 1108 array( 1109 'word (tm) word', 1110 'word ™ word', 1111 ), 1112 array( 1113 'word (tm)word', 1114 'word ™word', 1115 ), 1116 array( 1117 'word(tm) word', 1118 'word(tm) word', 1119 ), 1120 array( 1121 'word(tm)word', 1122 'word(tm)word', 1123 1123 ), 1124 1124 ); … … 1147 1147 array( 1148 1148 "word '42.00' word", 1149 "word ‘42.00’ word",1149 'word ‘42.00’ word', 1150 1150 ), 1151 1151 array( 1152 1152 "word '42.00'word", 1153 "word ‘42.00’word",1153 'word ‘42.00’word', 1154 1154 ), 1155 1155 array( … … 1167 1167 array( 1168 1168 "word '99's word", 1169 "word ’99’s word",1169 'word ’99’s word', 1170 1170 ), 1171 1171 array( 1172 1172 "word '99'samsonite", 1173 "word ’99’samsonite",1173 'word ’99’samsonite', 1174 1174 ), 1175 1175 ); … … 1202 1202 array( 1203 1203 "word---'quote'", 1204 "word—‘quote’",1204 'word—‘quote’', 1205 1205 ), 1206 1206 array( 1207 1207 "word--'quote'", 1208 "word–‘quote’",1208 'word–‘quote’', 1209 1209 ), 1210 1210 array( 1211 1211 "word-'quote'", 1212 "word-‘quote’",1212 'word-‘quote’', 1213 1213 ), 1214 1214 array( … … 1226 1226 array( 1227 1227 "'quote'---word", 1228 "‘quote’—word",1228 '‘quote’—word', 1229 1229 ), 1230 1230 array( 1231 1231 "'quote'--word", 1232 "‘quote’–word",1232 '‘quote’–word', 1233 1233 ), 1234 1234 array( 1235 1235 "'quote'-word", 1236 "‘quote’-word",1236 '‘quote’-word', 1237 1237 ), 1238 1238 ); … … 1277 1277 array( 1278 1278 '& <script>&&</script>', 1279 '& <script>&&</script>' 1279 '& <script>&&</script>', 1280 1280 ), 1281 1281 array( … … 1476 1476 array( 1477 1477 "word '99 word", 1478 "word ’99 word",1478 'word ’99 word', 1479 1479 ), 1480 1480 array( 1481 1481 "word '99. word", 1482 "word ’99. word",1482 'word ’99. word', 1483 1483 ), 1484 1484 array( 1485 1485 "word '99, word", 1486 "word ’99, word",1486 'word ’99, word', 1487 1487 ), 1488 1488 array( 1489 1489 "word '99; word", 1490 "word ’99; word",1490 'word ’99; word', 1491 1491 ), 1492 1492 array( 1493 1493 "word '99' word", // For this pattern, prime doesn't make sense. Should get apos and a closing quote. 1494 "word ’99’ word",1494 'word ’99’ word', 1495 1495 ), 1496 1496 array( 1497 1497 "word '99'. word", 1498 "word ’99’. word",1498 'word ’99’. word', 1499 1499 ), 1500 1500 array( 1501 1501 "word '99', word", 1502 "word ’99’, word",1502 'word ’99’, word', 1503 1503 ), 1504 1504 array( 1505 1505 "word '99.' word", 1506 "word ’99.’ word",1506 'word ’99.’ word', 1507 1507 ), 1508 1508 array( 1509 1509 "word '99", 1510 "word ’99",1510 'word ’99', 1511 1511 ), 1512 1512 array( 1513 1513 "'99 word", 1514 "’99 word",1514 '’99 word', 1515 1515 ), 1516 1516 array( 1517 1517 "word '999 word", // Does not match the apos pattern, should be opening quote. 1518 "word ‘999 word",1518 'word ‘999 word', 1519 1519 ), 1520 1520 array( 1521 1521 "word '99% word", 1522 "word ‘99% word",1522 'word ‘99% word', 1523 1523 ), 1524 1524 array( 1525 1525 "word '9 word", 1526 "word ‘9 word",1526 'word ‘9 word', 1527 1527 ), 1528 1528 array( 1529 1529 "word '99.9 word", 1530 "word ‘99.9 word",1530 'word ‘99.9 word', 1531 1531 ), 1532 1532 array( 1533 1533 "word '999", 1534 "word ‘999",1534 'word ‘999', 1535 1535 ), 1536 1536 array( 1537 1537 "word '9", 1538 "word ‘9",1538 'word ‘9', 1539 1539 ), 1540 1540 array( 1541 1541 "in '4 years, 3 months,' Obama cut the deficit", 1542 "in ‘4 years, 3 months,’ Obama cut the deficit",1542 'in ‘4 years, 3 months,’ Obama cut the deficit', 1543 1543 ), 1544 1544 array( 1545 1545 "testing's '4' through 'quotes'", 1546 "testing’s ‘4’ through ‘quotes’",1546 'testing’s ‘4’ through ‘quotes’', 1547 1547 ), 1548 1548 ); … … 1569 1569 1570 1570 function filter_translate( $translations, $text, $context, $domain ) { 1571 switch ($text) { 1572 case '–' : return '!endash!'; 1573 case '—' : return '!emdash!'; 1574 case '‘' : return '!openq1!'; 1575 case '’' : 1571 switch ( $text ) { 1572 case '–': 1573 return '!endash!'; 1574 case '—': 1575 return '!emdash!'; 1576 case '‘': 1577 return '!openq1!'; 1578 case '’': 1576 1579 if ( 'apostrophe' == $context ) { 1577 1580 return '!apos!'; … … 1579 1582 return '!closeq1!'; 1580 1583 } 1581 case '“' : return '!openq2!'; 1582 case '”' : return '!closeq2!'; 1583 case '′' : return '!prime1!'; 1584 case '″' : return '!prime2!'; 1585 case '’tain’t,’twere,’twas,’tis,’twill,’til,’bout,’nuff,’round,’cause,’em' : 1584 case '“': 1585 return '!openq2!'; 1586 case '”': 1587 return '!closeq2!'; 1588 case '′': 1589 return '!prime1!'; 1590 case '″': 1591 return '!prime2!'; 1592 case '’tain’t,’twere,’twas,’tis,’twill,’til,’bout,’nuff,’round,’cause,’em': 1586 1593 return '!apos!tain!apos!t,!apos!twere,!apos!twas,!apos!tis,!apos!twill,!apos!til,!apos!bout,!apos!nuff,!apos!round,!apos!cause,!apos!em'; 1587 default : return $translations; 1594 default: 1595 return $translations; 1588 1596 } 1589 1597 } … … 1593 1601 array( 1594 1602 "word '99 word", 1595 "word !apos!99 word",1603 'word !apos!99 word', 1596 1604 ), 1597 1605 array( 1598 1606 "word'99 word", 1599 "word!apos!99 word",1607 'word!apos!99 word', 1600 1608 ), 1601 1609 array( 1602 1610 "word 'test sentence' word", 1603 "word !openq1!test sentence!closeq1! word",1611 'word !openq1!test sentence!closeq1! word', 1604 1612 ), 1605 1613 array( 1606 1614 "'test sentence'", 1607 "!openq1!test sentence!closeq1!",1615 '!openq1!test sentence!closeq1!', 1608 1616 ), 1609 1617 array( … … 1617 1625 array( 1618 1626 "word 'word word", 1619 "word !openq1!word word",1627 'word !openq1!word word', 1620 1628 ), 1621 1629 array( 1622 1630 "word ('word word", 1623 "word (!openq1!word word",1631 'word (!openq1!word word', 1624 1632 ), 1625 1633 array( 1626 1634 "word ['word word", 1627 "word [!openq1!word word",1635 'word [!openq1!word word', 1628 1636 ), 1629 1637 array( … … 1645 1653 array( 1646 1654 "word 99' word", 1647 "word 99!prime1! word",1655 'word 99!prime1! word', 1648 1656 ), 1649 1657 array( 1650 1658 "word99' word", 1651 "word99!prime1! word",1659 'word99!prime1! word', 1652 1660 ), 1653 1661 array( 1654 1662 "word word's word", 1655 "word word!apos!s word",1663 'word word!apos!s word', 1656 1664 ), 1657 1665 array( 1658 1666 "word word'. word", 1659 "word word!closeq1!. word",1667 'word word!closeq1!. word', 1660 1668 ), 1661 1669 array( 1662 1670 "word ]'. word", 1663 "word ]!closeq1!. word",1671 'word ]!closeq1!. word', 1664 1672 ), 1665 1673 array( … … 1709 1717 array( 1710 1718 "word word' word", 1711 "word word!closeq1! word",1719 'word word!closeq1! word', 1712 1720 ), 1713 1721 array( 1714 1722 "word word'. word", 1715 "word word!closeq1!. word",1723 'word word!closeq1!. word', 1716 1724 ), 1717 1725 array( 1718 1726 "word word'.word", 1719 "word word!closeq1!.word",1727 'word word!closeq1!.word', 1720 1728 ), 1721 1729 array( 1722 1730 "word word'", 1723 "word word!closeq1!",1731 'word word!closeq1!', 1724 1732 ), 1725 1733 array( 1726 1734 "test sentence'.", 1727 "test sentence!closeq1!.",1735 'test sentence!closeq1!.', 1728 1736 ), 1729 1737 array( 1730 1738 "test sentence.'", 1731 "test sentence.!closeq1!",1739 'test sentence.!closeq1!', 1732 1740 ), 1733 1741 array( 1734 1742 "test sentence'. word", 1735 "test sentence!closeq1!. word",1743 'test sentence!closeq1!. word', 1736 1744 ), 1737 1745 array( 1738 1746 "test sentence.' word", 1739 "test sentence.!closeq1! word",1747 'test sentence.!closeq1! word', 1740 1748 ), 1741 1749 array( 1742 1750 "word 'tain't word", 1743 "word !apos!tain!apos!t word",1751 'word !apos!tain!apos!t word', 1744 1752 ), 1745 1753 array( 1746 1754 "word 'twere word", 1747 "word !apos!twere word",1755 'word !apos!twere word', 1748 1756 ), 1749 1757 array( … … 1753 1761 array( 1754 1762 "word '42.00' word", 1755 "word !openq1!42.00!closeq1! word",1763 'word !openq1!42.00!closeq1! word', 1756 1764 ), 1757 1765 array( 1758 1766 "word word'. word", 1759 "word word!closeq1!. word",1767 'word word!closeq1!. word', 1760 1768 ), 1761 1769 array( 1762 1770 "word word'.word", 1763 "word word!closeq1!.word",1771 'word word!closeq1!.word', 1764 1772 ), 1765 1773 array( 1766 1774 "word word', she said", 1767 "word word!closeq1!, she said",1775 'word word!closeq1!, she said', 1768 1776 ), 1769 1777 ); … … 1829 1837 function test_unregistered_shortcodes( $input, $output ) { 1830 1838 add_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 ); 1831 1839 1832 1840 $output = $this->assertEquals( $output, wptexturize( $input ) ); 1833 1841 1834 1842 remove_filter( 'no_texturize_shortcodes', array( $this, 'filter_shortcodes' ), 10, 1 ); 1835 1843 return $output; 1836 1844 } 1837 1845 1838 1846 function filter_shortcodes( $disabled ) { 1839 1847 $disabled[] = 'audio'; … … 1920 1928 array( 1921 1929 "George's porch is 99' long.", 1922 "George’s porch is 99′ long.",1930 'George’s porch is 99′ long.', 1923 1931 ), 1924 1932 array( … … 1928 1936 array( 1929 1937 "I need 4 x 20' = 80' of trim.", // Works only with a space before the = char. 1930 "I need 4 x 20′ = 80′ of trim.",1938 'I need 4 x 20′ = 80′ of trim.', 1931 1939 ), 1932 1940 array( … … 1936 1944 array( 1937 1945 "'Etiam eu egestas dui 1234'", 1938 "‘Etiam eu egestas dui 1234’",1946 '‘Etiam eu egestas dui 1234’', 1939 1947 ), 1940 1948 array( … … 1944 1952 array( 1945 1953 "The doctor said, 'An average height is between 5' and 6' in study group 7'. He then produced a 6' chart of averages. A man of 7', incredibly, is very possible.", 1946 "The doctor said, ‘An average height is between 5′ and 6′ in study group 7’. He then produced a 6′ chart of averages. A man of 7′, incredibly, is very possible.",1954 'The doctor said, ‘An average height is between 5′ and 6′ in study group 7’. He then produced a 6′ chart of averages. A man of 7′, incredibly, is very possible.', 1947 1955 ), 1948 1956 array( … … 1986 1994 1987 1995 function filter_translate2( $translations, $text, $context, $domain ) { 1988 switch ($text) { 1989 case '–' : return '!endash!'; 1990 case '—' : return '!emdash!'; 1991 case '‘' : return '!q1!'; 1992 case '’' : 1996 switch ( $text ) { 1997 case '–': 1998 return '!endash!'; 1999 case '—': 2000 return '!emdash!'; 2001 case '‘': 2002 return '!q1!'; 2003 case '’': 1993 2004 if ( 'apostrophe' == $context ) { 1994 2005 return '!apos!'; … … 1996 2007 return '!q1!'; 1997 2008 } 1998 case '“' : return '!q2!'; 1999 case '”' : return '!q2!'; 2000 case '′' : return '!prime1!'; 2001 case '″' : return '!prime2!'; 2002 default : return $translations; 2009 case '“': 2010 return '!q2!'; 2011 case '”': 2012 return '!q2!'; 2013 case '′': 2014 return '!prime1!'; 2015 case '″': 2016 return '!prime2!'; 2017 default: 2018 return $translations; 2003 2019 } 2004 2020 } … … 2008 2024 array( 2009 2025 "George's porch is 99' long.", 2010 "George!apos!s porch is 99!prime1! long.",2026 'George!apos!s porch is 99!prime1! long.', 2011 2027 ), 2012 2028 array( … … 2016 2032 array( 2017 2033 "I need 4 x 20' = 80' of trim.", // Works only with a space before the = char. 2018 "I need 4 x 20!prime1! = 80!prime1! of trim.",2034 'I need 4 x 20!prime1! = 80!prime1! of trim.', 2019 2035 ), 2020 2036 array( … … 2024 2040 array( 2025 2041 "'Etiam eu egestas dui 1234'", 2026 "!q1!Etiam eu egestas dui 1234!q1!",2042 '!q1!Etiam eu egestas dui 1234!q1!', 2027 2043 ), 2028 2044 array( … … 2032 2048 array( 2033 2049 "The doctor said, 'An average height is between 5' and 6' in study group 7'. He then produced a 6' chart of averages. A man of 7', incredibly, is very possible.", 2034 "The doctor said, !q1!An average height is between 5!prime1! and 6!prime1! in study group 7!q1!. He then produced a 6!prime1! chart of averages. A man of 7!prime1!, incredibly, is very possible.",2050 'The doctor said, !q1!An average height is between 5!prime1! and 6!prime1! in study group 7!q1!. He then produced a 6!prime1! chart of averages. A man of 7!prime1!, incredibly, is very possible.', 2035 2051 ), 2036 2052 array( … … 2063 2079 2064 2080 // With Shortcodes Disabled 2065 $regex = _get_wptexturize_split_regex();2081 $regex = _get_wptexturize_split_regex(); 2066 2082 $result = benchmark_pcre_backtracking( $regex, $input, 'split' ); 2067 2083 $this->assertLessThan( 200, $result ); … … 2069 2085 // With Shortcodes Enabled 2070 2086 $shortcode_regex = _get_wptexturize_shortcode_regex( array_keys( $shortcode_tags ) ); 2071 $regex = _get_wptexturize_split_regex( $shortcode_regex );2072 $result = benchmark_pcre_backtracking( $regex, $input, 'split' );2087 $regex = _get_wptexturize_split_regex( $shortcode_regex ); 2088 $result = benchmark_pcre_backtracking( $regex, $input, 'split' ); 2073 2089 return $this->assertLessThan( 200, $result ); 2074 2090 }
Note: See TracChangeset
for help on using the changeset viewer.