From 579e4262609447fa1182b2ce5ca258606bc2b45b Mon Sep 17 00:00:00 2001
From: Ryan Boren
Date: Mon, 5 Dec 2005 17:00:01 +0000
Subject: [PATCH] autop fixes from skeltoac. fixes #2022
git-svn-id: https://develop.svn.wordpress.org/trunk@3273 602fd350-edb4-49c9-b593-d223f7449a82
---
wp-includes/functions-formatting.php | 4 ++--
wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php
index 8b959d43ff..09cbffc175 100644
--- a/wp-includes/functions-formatting.php
+++ b/wp-includes/functions-formatting.php
@@ -59,12 +59,12 @@ function wpautop($pee, $br = 1) {
$pee = preg_replace('|
\s*
|', "\n\n", $pee);
// Space things out a little
$pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee);
- $pee = preg_replace('!((?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)!', "$1\n", $pee);
+ $pee = preg_replace('!((?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)!', "$1\n\n", $pee);
$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "$1
\n", $pee); // make paragraphs, including one at the end
$pee = preg_replace('|\s*?
|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
- $pee = preg_replace('!\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*
!', "$1", $pee); // don't pee all over a tag
+ $pee = preg_replace('!\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*
!', "$1", $pee); // don't pee all over a tag
$pee = preg_replace("|(
|", "$1", $pee); // problem with nested lists
$pee = preg_replace('|]*)>|i', "", $pee);
$pee = str_replace('
', '', $pee);
diff --git a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
index 099a5ecda6..9f0957fb66 100644
--- a/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
+++ b/wp-includes/js/tinymce/plugins/wordpress/editor_plugin.js
@@ -266,7 +266,7 @@ function wp_save_callback(el, content, body) {
content = content.replace(new RegExp('\\s*
\\s*', 'gi'), '\n');
// Fix some block element newline issues
- var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\d|pre';
+ var blocklist = 'blockquote|ul|ol|li|table|thead|tr|th|td|div|h\\d|pre';
content = content.replace(new RegExp('\\s*<(('+blocklist+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
content = content.replace(new RegExp('\\s*('+blocklist+')>\\s*', 'mg'), '$1>\n');
content = content.replace(new RegExp('', 'g'), '\t');