From 4e7dd2c4b1d5bfe20ce5391cfbc91b73dff737f1 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 8 Sep 2015 22:55:24 +0000 Subject: [PATCH] Formatting: maintain the content of HTML comments when they contain `` tags. Add more tests for wpaitop(). Props miqrogroove. Fixes #33645 for trunk. Built from https://develop.svn.wordpress.org/trunk@33955 git-svn-id: http://core.svn.wordpress.org/trunk@33924 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 6 ++++-- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 2fda875998..a84391f19e 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -496,7 +496,7 @@ function wpautop( $pee, $br = true ) { $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; // Add a single line break above block-level opening tags. - $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee); + $pee = preg_replace('!(<' . $allblocks . '[\s/>])!', "\n$1", $pee); // Add a double line break below block-level closing tags. $pee = preg_replace('!()!', "$1\n\n", $pee); @@ -596,7 +596,9 @@ function wpautop( $pee, $br = true ) { $pee = str_replace(array_keys($pre_tags), array_values($pre_tags), $pee); // Restore newlines in all elements. - $pee = str_replace( " ", "\n", $pee ); + if ( false !== strpos( $pee, '' ) ) { + $pee = str_replace( array( ' ', '' ), "\n", $pee ); + } return $pee; } diff --git a/wp-includes/version.php b/wp-includes/version.php index 3d6357bf15..b49e72c7e4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-33954'; +$wp_version = '4.4-alpha-33955'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.