[wp-trac] [WordPress Trac] #33377: Wpautop may create extra <br> tags

WordPress Trac noreply at wordpress.org
Sun Aug 16 20:56:16 UTC 2015

#33377: Wpautop may create extra <br> tags
 Reporter:  azaozz        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  high          |   Milestone:  4.3
Component:  Formatting    |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:

Comment (by azaozz):

 33377.3.diff looks good for now.

 Eventually in PHP we should do something similar to the JS -- remove line
 breaks after any <br>, replace remaining line breaks with <br>, add line
 breaks after all <br> to make it prettier.

 $pee = preg_replace( '|(<br[^>]*>)\s*\n|i', '$1', $pee );
 $pee = preg_replace( '|\s*\n|', '<br />', $pee );
 $pee = preg_replace( '|(<br[^>]*>)|i', "$1\n", $pee );

 This changes the behaviour so a bit reluctant to do it now, so close to

Ticket URL: <https://core.trac.wordpress.org/ticket/33377#comment:10>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list