Fix curly quotes around numbers when applicable.

Adds unit tests.

Props filosofo, mrmist, aliso, MikeHansenMe, miqrogroove.
Fixes #8775.


git-svn-id: https://develop.svn.wordpress.org/trunk@28721 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2014-06-10 02:42:35 +00:00
parent ce59109919
commit 013f3f14e3
2 changed files with 62 additions and 14 deletions

View File

@@ -88,6 +88,14 @@ function wptexturize($text) {
// Pattern-based replacements of characters.
$dynamic = array();
// Quoted Numbers like "42" or '42.00'
if ( '"' !== $opening_quote && '"' !== $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;
}
// '99 '99s '99's (apostrophe)
if ( "'" !== $apos ) {
$dynamic[ '/\'(?=\d)/' ] = $apos;