Make WordPress Core

Ticket #14674: 14674.6.diff

File 14674.6.diff, 1.3 KB (added by pento, 6 years ago)
  • src/wp-includes/formatting.php

    diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
    index 12e5bee017..e2c8aef269 100644
    a b function wpautop( $pee, $br = true ) { 
    500500        // Add a double line break below block-level closing tags.
    501501        $pee = preg_replace( '!(</' . $allblocks . '>)!', "$1\n\n", $pee );
    502502
     503        // Add a double line break after hr tags, which are self closing.
     504        $pee = preg_replace( '!(<hr\s*?/?>)!', "$1\n\n", $pee );
     505
    503506        // Standardize newline characters to "\n".
    504507        $pee = str_replace( array( "\r\n", "\r" ), "\n", $pee );
    505508
  • tests/phpunit/tests/formatting/Autop.php

    diff --git a/tests/phpunit/tests/formatting/Autop.php b/tests/phpunit/tests/formatting/Autop.php
    index 3f44949fe2..405b68ad34 100644
    a b Paragraph two.'; 
    312312                        'h4',
    313313                        'h5',
    314314                        'h6',
    315                         'hr',
    316315                        'fieldset',
    317316                        'legend',
    318317                        'section',
    line 2<br/> 
    558557                $this->assertEquals( $expected2, trim( wpautop( $content2 ) ) );
    559558        }
    560559
     560        /**
     561         * @ticket 14674
     562         */
     563        function test_the_hr_is_not_peed() {
     564                $content  = 'paragraph1<hr>paragraph2';
     565                $expected = "<p>paragraph1</p>\n<hr>\n<p>paragraph2</p>";
     566
     567                $this->assertEquals( $expected, trim( wpautop( $content ) ) );
     568        }
    561569}