Ticket #34722: 34722.diff
File 34722.diff, 1.8 KB (added by , 8 years ago) |
---|
-
wp-includes/formatting.php
474 474 // Add a double line break below block-level closing tags. 475 475 $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee); 476 476 477 // Add a double line break above and below Shortcode opening tags. 478 global $shortcode_tags; 479 $tagregexp = join( '|', array_map( 'preg_quote', array_keys( $shortcode_tags ) ) ); 480 $pee = preg_replace( '!(\[(\[?)(' . $tagregexp . ')\](\]?))!', "\n\n$1\n\n", $pee ); 481 482 // Add a double line break above and below Shortcode closing tags. 483 $pee = preg_replace( '!((\[?)\[\/(' . $tagregexp . ')\](\]?))!', "\n\n$1\n\n", $pee ); 484 477 485 // Standardize newline characters to "\n". 478 486 $pee = str_replace(array("\r\n", "\r"), "\n", $pee); 479 487 … … 523 531 // Under certain strange conditions it could create a P of entirely whitespace. 524 532 $pee = preg_replace('|<p>\s*</p>|', '', $pee); 525 533 534 // Remove <p> tags and line breaks around shortcodes 535 $pee = preg_replace( '!\n<p>(\[(\[?)(' . $tagregexp . ')\](\]?))</p>\n!', "$1", $pee ); 536 $pee = preg_replace( '!\n<p>((\[?)\[\/(' . $tagregexp . ')\](\]?))</p>\n!', "$1", $pee ); 537 526 538 // Add a closing <p> inside <div>, <address>, or <form> tag if missing. 527 539 $pee = preg_replace('!<p>([^<]+)</(div|address|form)>!', "<p>$1</p></$2>", $pee); 528 540 … … 538 550 539 551 // If an opening or closing block element tag is preceded by an opening <p> tag, remove it. 540 552 $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee); 541 542 553 // If an opening or closing block element tag is followed by a closing <p> tag, remove it. 543 554 $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); 544 555