From f1a15dd4fec8411b65f99eba59f92b2685b64d22 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 17 Jun 2014 20:19:14 +0000 Subject: [PATCH] Fix abbreviations mixed with quotes, example: `'99% of people'`. Add/alter unit tests. Props miqrogroove. Fixes #26850. Built from https://develop.svn.wordpress.org/trunk@28765 git-svn-id: http://core.svn.wordpress.org/trunk@28578 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index cfc1e52130..82205744fe 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -111,17 +111,17 @@ function wptexturize($text, $reset = false) { $dynamic[ '/\'(\d\d)"(?=\Z|[.,)}>\-\]]|' . $spaces . ')/' ] = $apos . '$1' . $closing_quote; } - // '99 '99s '99's (apostrophe) But never '9 or '999 or '99.0. + // '99 '99s '99's (apostrophe) But never '9 or '99% or '999 or '99.0. if ( "'" !== $apos ) { - $dynamic[ '/\'(?=\d\d(?:\Z|(?!\d|[.,]\d)))/' ] = $apos; + $dynamic[ '/\'(?=\d\d(?:\Z|(?![%\d]|[.,]\d)))/' ] = $apos; } // Quoted Numbers like "42" or '42.00' if ( '"' !== $opening_quote && '"' !== $closing_quote ) { - $dynamic[ '/(?<=\A|' . $spaces . ')"(\d[\d\.\,]*)"/' ] = $opening_quote . '$1' . $closing_quote; + $dynamic[ '/(?<=\A|' . $spaces . ')"(\d[.,\d]*)"/' ] = $opening_quote . '$1' . $closing_quote; } if ( "'" !== $opening_single_quote && "'" !== $closing_single_quote ) { - $dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[\d\.\,]*)\'/' ] = $opening_single_quote . '$1' . $closing_single_quote; + $dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[.,\d]*)\'/' ] = $opening_single_quote . '$1' . $closing_single_quote; } // Single quote at start, or preceded by (, {, <, [, ", -, or spaces.