WordPress.org

Make WordPress Core

Ticket #7988: wpautop.p.2.diff

File wpautop.p.2.diff, 869 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); 
     135        $pee = preg_replace('#<p>\s*?(?!\s)([^<]+)\s*?(</(?:div|address|form)[^>]*>)#', "<p>$1</p>$2", $pee); 
    136136        $pee = preg_replace( '|<p>|', "$1<p>", $pee ); 
    137137        $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag 
    138138        $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists