WordPress.org

Make WordPress Core

Ticket #3669: ptag-formatting.patch

File ptag-formatting.patch, 820 bytes (added by scenic, 7 years ago)

Patch to fix this bug

  • formatting.php

    old new function wpautop($pee, $br = 1) { 
    6464        $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end 
    6565        $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace 
    6666        $pee = preg_replace( '|<p>(<div[^>]*>\s*)|', "$1<p>", $pee ); 
     67        $pee = preg_replace( '|(</div[^>]*>\s*)</p>|', "</p>$1", $pee ); 
    6768        $pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee); 
    6869        $pee = preg_replace( '|<p>|', "$1<p>", $pee ); 
    6970        $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag