Formatting: Revert the changes to `wpautop()` in [45585,45587].
See #27350. Built from https://develop.svn.wordpress.org/trunk@45589 git-svn-id: http://core.svn.wordpress.org/trunk@45400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
073f379fd3
commit
55b2d94cca
|
@ -492,8 +492,7 @@ function wpautop( $pee, $br = true ) {
|
||||||
// Change multiple <br>s into two line breaks, which will turn into paragraphs.
|
// Change multiple <br>s into two line breaks, which will turn into paragraphs.
|
||||||
$pee = preg_replace( '|<br\s*/?>\s*<br\s*/?>|', "\n\n", $pee );
|
$pee = preg_replace( '|<br\s*/?>\s*<br\s*/?>|', "\n\n", $pee );
|
||||||
|
|
||||||
$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)\b';
|
$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)';
|
||||||
$allblocksexceptp = str_replace( '|p|', '|', $allblocks );
|
|
||||||
|
|
||||||
// Add a double line break above block-level opening tags.
|
// Add a double line break above block-level opening tags.
|
||||||
$pee = preg_replace( '!(<' . $allblocks . '[\s/>])!', "\n\n$1", $pee );
|
$pee = preg_replace( '!(<' . $allblocks . '[\s/>])!', "\n\n$1", $pee );
|
||||||
|
@ -559,12 +558,12 @@ function wpautop( $pee, $br = true ) {
|
||||||
// Under certain strange conditions it could create a P of entirely whitespace.
|
// Under certain strange conditions it could create a P of entirely whitespace.
|
||||||
$pee = preg_replace( '|<p>\s*</p>|', '', $pee );
|
$pee = preg_replace( '|<p>\s*</p>|', '', $pee );
|
||||||
|
|
||||||
// If an opening or closing block element tag is wrapped in a <p>, unwrap it.
|
|
||||||
$pee = preg_replace( '!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', '$1', $pee );
|
|
||||||
|
|
||||||
// Add a closing <p> inside <div>, <address>, or <form> tag if missing.
|
// Add a closing <p> inside <div>, <address>, or <form> tag if missing.
|
||||||
$pee = preg_replace( '!<p>([^<]+)</(div|address|form)>!', '<p>$1</p></$2>', $pee );
|
$pee = preg_replace( '!<p>([^<]+)</(div|address|form)>!', '<p>$1</p></$2>', $pee );
|
||||||
|
|
||||||
|
// If an opening or closing block element tag is wrapped in a <p>, unwrap it.
|
||||||
|
$pee = preg_replace( '!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', '$1', $pee );
|
||||||
|
|
||||||
// In some cases <li> may get wrapped in <p>, fix them.
|
// In some cases <li> may get wrapped in <p>, fix them.
|
||||||
$pee = preg_replace( '|<p>(<li.+?)</p>|', '$1', $pee );
|
$pee = preg_replace( '|<p>(<li.+?)</p>|', '$1', $pee );
|
||||||
|
|
||||||
|
@ -578,12 +577,6 @@ function wpautop( $pee, $br = true ) {
|
||||||
// If an opening or closing block element tag is followed by a closing <p> tag, remove it.
|
// If an opening or closing block element tag is followed by a closing <p> tag, remove it.
|
||||||
$pee = preg_replace( '!(</?' . $allblocks . '[^>]*>)\s*</p>!', '$1', $pee );
|
$pee = preg_replace( '!(</?' . $allblocks . '[^>]*>)\s*</p>!', '$1', $pee );
|
||||||
|
|
||||||
// If a closing <p> tag is inside a block element tag, without a preceding opening <p> tag, remove it.
|
|
||||||
$pee = preg_replace( '#(<(' . $allblocksexceptp . ')[^>]*>)(((?!<p>|</\2>).)*)</p>#s', '$1$3', $pee );
|
|
||||||
|
|
||||||
// If an opening <p> tag is inside a block element tag, without a following closing <p> tag, remove it.
|
|
||||||
$pee = preg_replace( '#<p>([^<]*(((?!</p>).)*)</' . $allblocksexceptp . '>)#s', '$1', $pee );
|
|
||||||
|
|
||||||
// Optionally insert line breaks.
|
// Optionally insert line breaks.
|
||||||
if ( $br ) {
|
if ( $br ) {
|
||||||
// Replace newlines that shouldn't be touched with a placeholder.
|
// Replace newlines that shouldn't be touched with a placeholder.
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.3-alpha-45588';
|
$wp_version = '5.3-alpha-45589';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue