Make WordPress Core

Ticket #14674: 14674.5.diff

File 14674.5.diff, 1.2 KB (added by MattyRob, 9 years ago)
  • src/wp-includes/formatting.php

     
    474474        // Add a double line break below block-level closing tags.
    475475        $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee);
    476476
     477        // hr's are block-level and self-closing
     478        $pee = preg_replace('!(<hr\s?/?>)!', "\n\n$1\n\n", $pee );
     479
    477480        // Standardize newline characters to "\n".
    478481        $pee = str_replace(array("\r\n", "\r"), "\n", $pee);
    479482
  • tests/phpunit/tests/formatting/Autop.php

     
    312312                        'h4',
    313313                        'h5',
    314314                        'h6',
    315                         'hr',
    316315                        'fieldset',
    317316                        'legend',
    318317                        'section',
     
    534533
    535534                $this->assertEquals( $expected, trim( wpautop( $content ) ) );
    536535        }
     536
     537        /**
     538         * @ticket 14674
     539         */
     540        function test_the_hr_is_not_peed() {
     541                $content = 'paragraph1<hr>paragraph2';
     542                $expected = "<p>paragraph1</p>\n<hr>\n<p>paragraph2</p>";
     543
     544                $this->assertEquals( $expected, trim( wpautop( $content ) ) );
     545        }
    537546}