mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 15:08:10 +01:00
autop fixes from skeltoac. fixes #2022
git-svn-id: http://svn.automattic.com/wordpress/trunk@3273 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9d4c41b823
commit
3d55d1e28c
@ -59,7 +59,7 @@ function wpautop($pee, $br = 1) {
|
||||
$pee = preg_replace('|<br />\s*<br />|', "\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', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
|
||||
|
@ -266,7 +266,7 @@ function wp_save_callback(el, content, body) {
|
||||
content = content.replace(new RegExp('\\s*<br ?/?>\\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('<li>', 'g'), '\t<li>');
|
||||
|
Loading…
Reference in New Issue
Block a user