Make WordPress Core

Ticket #20342: 20342.2.diff

File 20342.2.diff, 2.7 KB (added by adamsilverstein, 11 years ago)

opening double quote, even after -

  • src/wp-includes/formatting.php

     
    7979                        $dynamic[ '/\'(\d)/'                   ] = $apos . '$1'; // '99
    8080                }
    8181                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 (, {, <, [, -
    8383                if ( '"' != $double_prime )
    8484                        $dynamic[ '/(\d)"/'                    ] = '$1' . $double_prime; // 9" (double prime)
    8585                if ( "'" != $prime )
     
    8787                if ( "'" != $apos )
    8888                        $dynamic[ '/(\S)\'([^\'\s])/'          ] = '$1' . $apos . '$2'; // apostrophe in a word
    8989                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 (, {, <, [, -
    9191                if ( '"' != $closing_quote )
    9292                        $dynamic[ '/"(\s|\S|\Z)/'              ] = $closing_quote . '$1'; // closing double quote
    9393                if ( "'" != $closing_single_quote )
     
    134134                } elseif ( '[' === $first ) {
    135135                        _wptexturize_pushpop_element($curl, $no_texturize_shortcodes_stack, $no_texturize_shortcodes, '[', ']');
    136136                } elseif ( empty($no_texturize_shortcodes_stack) && empty($no_texturize_tags_stack) ) {
     137                        // regular expressions
     138                        $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
    137139                        // This is not a tag, nor is the texturization disabled static strings
    138140                        $curl = str_replace($static_characters, $static_replacements, $curl);
    139                         // regular expressions
    140                         $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl);
    141141                }
    142142                $curl = preg_replace('/&([^#])(?![a-zA-Z1-4]{1,8};)/', '&#038;$1', $curl);
    143143        }
  • tests/phpunit/tests/formatting/WPTexturize.php

     
    194194                $this->assertEquals( ' &#8212;&nbsp;', wptexturize( ' --&nbsp;' ) );
    195195                $this->assertEquals( '&nbsp;&#8212; ', wptexturize( '&nbsp;-- ') );
    196196        }
     197
     198        /**
     199         * @ticket 20342
     200         */
     201        function test_quotes_after_emdash() {
     202                $this->assertEquals( '<p>I also remember the line in &#8220;Casey at the Bat&#8221; when he struck out&#8212; &#8220;There is no Joy in Mudville!!!&#8221;</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        }
    197204}