Ticket #37672: 37672.diff
File 37672.diff, 1.8 KB (added by , 8 years ago) |
---|
-
src/wp-includes/formatting.php
474 474 // Add a double line break below block-level closing tags. 475 475 $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee); 476 476 477 // Treat <div> as special and put a new line below opening tags and above closing tags 478 $pee = preg_replace('!(<div>)!', "$1\n", $pee); 479 $pee = preg_replace('!(</div>)!', "\n$1", $pee); 480 477 481 // Standardize newline characters to "\n". 478 482 $pee = str_replace(array("\r\n", "\r"), "\n", $pee); 479 483 … … 523 530 // Under certain strange conditions it could create a P of entirely whitespace. 524 531 $pee = preg_replace('|<p>\s*</p>|', '', $pee); 525 532 533 // Remove the space we added to the <div> tag 534 $pee = preg_replace("!(<div>)[/\n]+!", "$1", $pee); 535 $pee = preg_replace("![/\n]+(</div>)!", "$1", $pee); 536 526 537 // Add a closing <p> inside <div>, <address>, or <form> tag if missing. 527 538 $pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee); 528 539 -
tests/phpunit/tests/formatting/Autop.php
534 532 535 533 $this->assertEquals( $expected, trim( wpautop( $content ) ) ); 536 534 } 535 536 /** 537 * @ticket 37672 538 */ 539 function test_that_div_content_is_correctly_peed() { 540 $content = "<div>\nThis is a paragraph.\n\nThis is another paragraph.\n</div>"; 541 $expected = "<div>\n<p>This is a paragraph.</p>\n<p>This is another paragraph.</p>\n</div>"; 542 543 $this->assertEquals( $expected, trim( wpautop( $content ) ) ); 544 } 537 545 }