`wptexturize()` adjustments:
* Only place an apostrophe before a number when it has exactly two digits. * Never match '99' with the single prime pattern. * Always assume '99' is an abbreviated year at the end of a quotation. * Add unit tests. * Resolves the unit test broken in [28721] for #8775. See #26850. Built from https://develop.svn.wordpress.org/trunk@28761 git-svn-id: http://core.svn.wordpress.org/trunk@28574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e85c3deba5
commit
337e5f7ae4
|
@ -100,6 +100,16 @@ function wptexturize($text) {
|
|||
// Pattern-based replacements of characters.
|
||||
$dynamic = array();
|
||||
|
||||
// '99' is an ambiguous case among other patterns; assume it's an abbreviated year at the end of a quotation.
|
||||
if ( "'" !== $apos && "'" !== $closing_single_quote ) {
|
||||
$dynamic[ '/\'(\d\d)\'(?=\Z|[.,)}>\-\]]|' . $spaces . ')/' ] = $apos . '$1' . $closing_single_quote;
|
||||
}
|
||||
|
||||
// '99 '99s '99's (apostrophe) But never '9 or '999 or '99.0.
|
||||
if ( "'" !== $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;
|
||||
|
@ -108,11 +118,6 @@ function wptexturize($text) {
|
|||
$dynamic[ '/(?<=\A|' . $spaces . ')\'(\d[\d\.\,]*)\'/' ] = $opening_single_quote . '$1' . $closing_single_quote;
|
||||
}
|
||||
|
||||
// '99 '99s '99's (apostrophe)
|
||||
if ( "'" !== $apos ) {
|
||||
$dynamic[ '/\'(?=\d)/' ] = $apos;
|
||||
}
|
||||
|
||||
// Single quote at start, or preceded by (, {, <, [, ", -, or spaces.
|
||||
if ( "'" !== $opening_single_quote ) {
|
||||
$dynamic[ '/(?<=\A|[([{<"\-]|' . $spaces . ')\'/' ] = $opening_single_quote;
|
||||
|
|
Loading…
Reference in New Issue