Fix curly quotes around numbers when applicable.
Adds unit tests. Props filosofo, mrmist, aliso, MikeHansenMe, miqrogroove. Fixes #8775. Built from https://develop.svn.wordpress.org/trunk@28721 git-svn-id: http://core.svn.wordpress.org/trunk@28535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5219bbbbc9
commit
f8b03aa528
|
@ -88,6 +88,14 @@ function wptexturize($text) {
|
||||||
// Pattern-based replacements of characters.
|
// Pattern-based replacements of characters.
|
||||||
$dynamic = array();
|
$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)
|
// '99 '99s '99's (apostrophe)
|
||||||
if ( "'" !== $apos ) {
|
if ( "'" !== $apos ) {
|
||||||
$dynamic[ '/\'(?=\d)/' ] = $apos;
|
$dynamic[ '/\'(?=\d)/' ] = $apos;
|
||||||
|
|
Loading…
Reference in New Issue