mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-22 00:01:27 +01:00
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
This commit is contained in:
parent
2bac3b660f
commit
f1a15dd4fe
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user