WordPress.org

Make WordPress Core

Ticket #7988: wpautop.morespecific.diff

File wpautop.morespecific.diff, 943 bytes (added by filosofo, 5 years ago)
  • wp-includes/formatting.php

     
    132132        foreach ( $pees as $tinkle ) 
    133133                $pee .= '<p>' . trim($tinkle, "\n") . "</p>\n"; 
    134134        $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace 
    135         $pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee); 
    136         $pee = preg_replace( '|<p>|', "$1<p>", $pee ); 
     135        $pee = preg_replace('#<p>\s*?(?!</)(\S.*)(</(?:address|div|form)[^>]*>)#', "<p>$1</p>$2", $pee); 
    137136        $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag 
    138137        $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists 
    139138        $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);