Ticket #20342: 20342.2.diff
File 20342.2.diff, 2.7 KB (added by , 11 years ago) |
---|
-
src/wp-includes/formatting.php
79 79 $dynamic[ '/\'(\d)/' ] = $apos . '$1'; // '99 80 80 } 81 81 if ( "'" != $opening_single_quote ) 82 $dynamic[ '/(\s|\A|[([{< ]|")\'/' ] = '$1' . $opening_single_quote; // opening single quote, even after (, {, <, [82 $dynamic[ '/(\s|\A|[([{<-]|")\'/' ] = '$1' . $opening_single_quote; // opening single quote, even after (, {, <, [, - 83 83 if ( '"' != $double_prime ) 84 84 $dynamic[ '/(\d)"/' ] = '$1' . $double_prime; // 9" (double prime) 85 85 if ( "'" != $prime ) … … 87 87 if ( "'" != $apos ) 88 88 $dynamic[ '/(\S)\'([^\'\s])/' ] = '$1' . $apos . '$2'; // apostrophe in a word 89 89 if ( '"' != $opening_quote ) 90 $dynamic[ '/(\s|\A|[([{< ])"(?!\s)/' ] = '$1' . $opening_quote . '$2'; // opening double quote, even after (, {, <, [90 $dynamic[ '/(\s|\A|[([{<-])"(?!\s)/' ] = '$1' . $opening_quote . '$2'; // opening double quote, even after (, {, <, [, - 91 91 if ( '"' != $closing_quote ) 92 92 $dynamic[ '/"(\s|\S|\Z)/' ] = $closing_quote . '$1'; // closing double quote 93 93 if ( "'" != $closing_single_quote ) … … 134 134 } elseif ( '[' === $first ) { 135 135 _wptexturize_pushpop_element($curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes, '[', ']'); 136 136 } elseif ( empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack) ) { 137 // regular expressions 138 $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl); 137 139 // This is not a tag, nor is the texturization disabled static strings 138 140 $curl = str_replace($static_characters, $static_replacements, $curl); 139 // regular expressions140 $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);141 141 } 142 142 $curl = preg_replace('/&([^#])(?![a-zA-Z1-4]{1,8};)/', '&$1', $curl); 143 143 } -
tests/phpunit/tests/formatting/WPTexturize.php
194 194 $this->assertEquals( ' — ', wptexturize( ' -- ' ) ); 195 195 $this->assertEquals( ' — ', wptexturize( ' -- ') ); 196 196 } 197 198 /** 199 * @ticket 20342 200 */ 201 function test_quotes_after_emdash() { 202 $this->assertEquals( '<p>I also remember the line in “Casey at the Bat” when he struck out— “There is no Joy in Mudville!!!”</p>', wptexturize( '<p>I also remember the line in "Casey at the Bat" when he struck out--- "There is no Joy in Mudville!!!"</p>' ) ); 203 } 197 204 }