From 8fe50513608c519f36ee42f658f431ca628d9c9e Mon Sep 17 00:00:00 2001
From: Steven Wittens $1 \s*? ( ", $chunk);
$chunk = str_replace(', , tags.
// We don't apply any processing to the contents of these tags to avoid messing
// up code. We look for matched pairs and allow basic nesting. For example:
@@ -1077,18 +1080,18 @@ function _filter_autop($text) {
else if (!$ignore) {
$chunk = preg_replace('|\n*$|', '', $chunk) ."\n\n"; // just to make things a little easier, pad the end
$chunk = preg_replace('|
\s*
|', "\n\n", $chunk);
- $chunk = preg_replace('!(<(?:table|ul|ol|li|pre|form|blockquote|h[1-6])[^>]*>)!', "\n$1", $chunk); // Space things out a little
- $chunk = preg_replace('!((?:table|ul|ol|li|pre|form|blockquote|h[1-6])>)!', "$1\n", $chunk); // Space things out a little
+ $chunk = preg_replace('!(<'. $block .'[^>]*>)!', "\n$1", $chunk); // Space things out a little
+ $chunk = preg_replace('!('. $block .'>)!', "$1\n\n", $chunk); // Space things out a little
$chunk = preg_replace("/\n\n+/", "\n\n", $chunk); // take care of duplicates
$chunk = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "]*)>|i', "
\s*(?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)!', "$1", $chunk); - $chunk = preg_replace('!(?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*
!', "$1", $chunk); + $chunk = preg_replace('!\s*(?'. $block .'[^>]*>)!', "$1", $chunk); + $chunk = preg_replace('!(?'. $block .'[^>]*>)\s*
!', "$1", $chunk); $chunk = preg_replace('|(?)\s*\n|', ", , tags. // We don't apply any processing to the contents of these tags to avoid messing // up code. We look for matched pairs and allow basic nesting. For example: @@ -1077,18 +1080,18 @@ function _filter_autop($text) { else if (!$ignore) { $chunk = preg_replace('|\n*$|', '', $chunk) ."\n\n"; // just to make things a little easier, pad the end $chunk = preg_replace('|
\s*
|', "\n\n", $chunk); - $chunk = preg_replace('!(<(?:table|ul|ol|li|pre|form|blockquote|h[1-6])[^>]*>)!', "\n$1", $chunk); // Space things out a little - $chunk = preg_replace('!((?:table|ul|ol|li|pre|form|blockquote|h[1-6])>)!', "$1\n", $chunk); // Space things out a little + $chunk = preg_replace('!(<'. $block .'[^>]*>)!', "\n$1", $chunk); // Space things out a little + $chunk = preg_replace('!('. $block .'>)!', "$1\n\n", $chunk); // Space things out a little $chunk = preg_replace("/\n\n+/", "\n\n", $chunk); // take care of duplicates $chunk = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "$1
\n", $chunk); // make paragraphs, including one at the end $chunk = preg_replace('|\s*?
|', '', $chunk); // under certain strange conditions it could create a P of entirely whitespace $chunk = preg_replace("|(
]*)>|i', "', $chunk); - $chunk = preg_replace('!', '", $chunk); $chunk = str_replace('
\s*(?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)!', "$1", $chunk); - $chunk = preg_replace('!(?(?:table|tr|td|th|div|ul|ol|li|pre|select|form|blockquote|p|h[1-6])[^>]*>)\s*
!', "$1", $chunk); + $chunk = preg_replace('!\s*(?'. $block .'[^>]*>)!', "$1", $chunk); + $chunk = preg_replace('!(?'. $block .'[^>]*>)\s*
!', "$1", $chunk); $chunk = preg_replace('|(?)\s*\n|', "