Ticket #13340: 13340.diff
| File 13340.diff, 1.8 KB (added by wojtek.szkutnik, 3 years ago) |
|---|
-
formatting.php
185 185 $pee = $pee . "\n"; // just to make things a little easier, pad the end 186 186 $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee); 187 187 // Space things out a little 188 $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address| math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';188 $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|option|form|map|area|blockquote|address|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; 189 189 $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee); 190 190 $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee); 191 191 $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines … … 208 208 $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee); 209 209 $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); 210 210 if ($br) { 211 $pee = preg_replace_callback('/<(script|style ).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", "<WPPreserveNewline />", $matches[0]);'), $pee);211 $pee = preg_replace_callback('/<(script|style|math).*?<\/\\1>/s', create_function('$matches', 'return str_replace("\n", "<WPPreserveNewline />", $matches[0]);'), $pee); 212 212 $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks 213 213 $pee = str_replace('<WPPreserveNewline />', "\n", $pee); 214 214 }
