From 1173ae686701954eb3209a9774daf00a65df3351 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Sat, 4 Sep 2004 20:47:52 +0000 Subject: [PATCH] Texturize fix. git-svn-id: https://develop.svn.wordpress.org/trunk@1592 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions-formatting.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 4b3ca708d3..d8d53583bb 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);