Make WordPress Core

Ticket #1099: formatting.php.diff

File formatting.php.diff, 1.0 KB (added by filosofo, 20 years ago)
  • formatting.php

     
    6363        $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
    6464        $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
    6565        $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
     66        $pee = preg_replace('!(<(?:div|address|form)[^>]*>)([^<]+)</p>!', "$1<p>$2</p>", $pee);
     67        $pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee);
    6668        $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
    6769        $pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
    6870        $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists