diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 4b3ca708d..d8d53583b 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -12,8 +12,9 @@ function wptexturize($text) { if (isset($curl{0}) && '<' != $curl{0} && $next) { // If it's not a tag $curl = str_replace('---', '—', $curl); + $curl = preg_replace('/(\s)--(\s)/', '$1—$2', $curl); $curl = str_replace('--', '–', $curl); - $curl = str_replace("...", '…', $curl); + $curl = str_replace('...', '…', $curl); $curl = str_replace('``', '“', $curl); // This is a hack, look at this more later. It works pretty well though. @@ -28,11 +29,11 @@ function wptexturize($text) { $curl = preg_replace("/(\d+)'/", '$1′', $curl); $curl = preg_replace("/(\S)'([^'\s])/", "$1’$2", $curl); $curl = preg_replace('/(\s|\A)"(?!\s)/', '$1“$2', $curl); - $curl = preg_replace('/"(\s|\Z)/', '”$1', $curl); + $curl = preg_replace('/"(\s|\S|\Z)/', '”$1', $curl); $curl = preg_replace("/'([\s.]|\Z)/", '’$1', $curl); - $curl = preg_replace("/\(tm\)/i", '™', $curl); - $curl = preg_replace("/\(c\)/i", '©', $curl); - $curl = preg_replace("/\(r\)/i", '®', $curl); + $curl = preg_replace("/ \(tm\)/i", ' ™', $curl); + $curl = preg_replace("/ \(c\)/i", ' ©', $curl); + $curl = preg_replace("/ \(r\)/i", ' ®', $curl); $curl = str_replace("''", '”', $curl); $curl = preg_replace('/(d+)x(\d+)/', "$1×$2", $curl);