Ticket #23185: miqro-23185.patch
File miqro-23185.patch, 2.9 KB (added by , 11 years ago) |
---|
-
src/wp-includes/formatting.php
70 70 $cockney = $cockneyreplace = array(); 71 71 } 72 72 73 $static_characters = array_merge( array( '---', ' -- ', '--', ' - ', 'xn–', '...', '``', '\'\'', ' (tm)' ), $cockney );74 $static_replacements = array_merge( array( $em_dash, ' ' . $em_dash . ' ', $en_dash, ' ' . $en_dash . ' ', 'xn--', '…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace );73 $static_characters = array_merge( array( '---', '...', '``', '\'\'', ' (tm)' ), $cockney ); 74 $static_replacements = array_merge( array( $em_dash, '…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace ); 75 75 76 76 /* 77 77 * Regex for common whitespace characters. … … 126 126 $dynamic[ '/\'(?=\Z|\.|' . $spaces . ')/' ] = $closing_single_quote; 127 127 } 128 128 129 // Dashes and spaces 130 $dynamic[ '/(?<=' . $spaces . ')--(?=' . $spaces . ')/' ] = $em_dash; 131 $dynamic[ '/(?<!xn)--/' ] = $en_dash; 132 $dynamic[ '/(?<=' . $spaces . ')-(?=' . $spaces . ')/' ] = $en_dash; 133 129 134 $dynamic_characters = array_keys( $dynamic ); 130 135 $dynamic_replacements = array_values( $dynamic ); 131 136 } -
tests/phpunit/tests/formatting/WPTexturize.php
187 187 * @ticket 23185 188 188 */ 189 189 function test_spaces_around_hyphens() { 190 $nbsp = "\xC2\xA0"; 191 190 192 $this->assertEquals( ' – ', wptexturize( ' - ' ) ); 191 193 $this->assertEquals( ' – ', wptexturize( ' - ' ) ); 192 194 $this->assertEquals( ' – ', wptexturize( ' - ' ) ); 193 195 $this->assertEquals( ' – ', wptexturize( ' - ') ); 196 $this->assertEquals( "$nbsp–$nbsp", wptexturize( "$nbsp-$nbsp" ) ); 197 $this->assertEquals( " –$nbsp", wptexturize( " -$nbsp" ) ); 198 $this->assertEquals( "$nbsp– ", wptexturize( "$nbsp- ") ); 194 199 195 200 $this->assertEquals( ' — ', wptexturize( ' -- ' ) ); 196 201 $this->assertEquals( ' — ', wptexturize( ' -- ' ) ); 197 202 $this->assertEquals( ' — ', wptexturize( ' -- ' ) ); 198 203 $this->assertEquals( ' — ', wptexturize( ' -- ') ); 204 $this->assertEquals( "$nbsp—$nbsp", wptexturize( "$nbsp--$nbsp" ) ); 205 $this->assertEquals( " —$nbsp", wptexturize( " --$nbsp" ) ); 206 $this->assertEquals( "$nbsp— ", wptexturize( "$nbsp-- ") ); 199 207 } 200 208 201 209 /** … … 929 937 ), 930 938 array( 931 939 "word xn– word", 932 "word xn --word",940 "word xn– word", 933 941 ), 934 942 array( 935 943 "wordxn–word", 944 "wordxn–word", 945 ), 946 array( 936 947 "wordxn--word", 948 "wordxn--word", 937 949 ), 938 950 ); 939 951 }