mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-10 14:48:07 +02:00
More autop tweaks. This function is becoming very mature.
git-svn-id: http://svn.automattic.com/wordpress/trunk@337 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ba75a65103
commit
5ed06746cc
@ -67,6 +67,7 @@ function wptexturize($text) {
|
|||||||
function wpautop($pee, $br=1) {
|
function wpautop($pee, $br=1) {
|
||||||
$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
|
$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
|
||||||
$pee = preg_replace('!(<(?:table|ul|ol|li|pre|select|form|blockquote)[^>]*>)!', "\n$1", $pee); // Space things out a little
|
$pee = preg_replace('!(<(?:table|ul|ol|li|pre|select|form|blockquote)[^>]*>)!', "\n$1", $pee); // Space things out a little
|
||||||
|
$pee = preg_replace('!(</(?:table|ul|ol|li|pre|select|form|blockquote)>)!', "$1\n", $pee); // Space things out a little
|
||||||
$pee = preg_replace("/(\r\n|\n|\r)/", "\n", $pee); // cross-platform newlines
|
$pee = preg_replace("/(\r\n|\n|\r)/", "\n", $pee); // cross-platform newlines
|
||||||
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
|
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
|
||||||
$pee = preg_replace('/\n?(.+?)(\n\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
|
$pee = preg_replace('/\n?(.+?)(\n\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
|
||||||
@ -78,7 +79,7 @@ function wpautop($pee, $br=1) {
|
|||||||
$pee = preg_replace('!<p>\s*(</?(?:table|ul|ol|li|pre|select|form|blockquote)[^>]*>)!', "$1", $pee);
|
$pee = preg_replace('!<p>\s*(</?(?:table|ul|ol|li|pre|select|form|blockquote)[^>]*>)!', "$1", $pee);
|
||||||
$pee = preg_replace('!(</?(?:table|ul|ol|li|pre|select|form|blockquote)>)\s*</p>!', "$1", $pee);
|
$pee = preg_replace('!(</?(?:table|ul|ol|li|pre|select|form|blockquote)>)\s*</p>!', "$1", $pee);
|
||||||
if ($br) $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
|
if ($br) $pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
|
||||||
$pee = preg_replace('!(</?(?:table|ul|ol|li|pre|select|form|blockquote|p)[^>]*>)<br />!', "$1", $pee);
|
$pee = preg_replace('!(</?(?:table|ul|ol|li|pre|select|form|blockquote|p)[^>]*>)\s*<br />!', "$1", $pee);
|
||||||
$pee = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $pee);
|
$pee = preg_replace('/&([^#])(?![a-z]{1,8};)/', '&$1', $pee);
|
||||||
|
|
||||||
return $pee;
|
return $pee;
|
||||||
|
Loading…
Reference in New Issue
Block a user