In `wptexturize()`, adjust for the treatment of abbreviated years at the end of quotations.

Silence some unit tests that have never passed and may no longer be applicable.

Props miqrogroove.
Fixes #18549.

Built from https://develop.svn.wordpress.org/trunk@28764


git-svn-id: http://core.svn.wordpress.org/trunk@28577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2014-06-17 20:14:15 +00:00
parent 3b3fb72ce3
commit 2bac3b660f
1 changed files with 8 additions and 4 deletions

View File

@ -102,11 +102,15 @@ function wptexturize($text, $reset = false) {
// 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 ) {
// '99' and '99" are ambiguous 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;
}
if ( "'" !== $apos || '"' !== $closing_quote ) {
$dynamic[ '/\'(\d\d)"(?=\Z|[.,)}>\-\]]|' . $spaces . ')/' ] = $apos . '$1' . $closing_quote;
}
// '99 '99s '99's (apostrophe) But never '9 or '999 or '99.0.
if ( "'" !== $apos ) {
$dynamic[ '/\'(?=\d\d(?:\Z|(?!\d|[.,]\d)))/' ] = $apos;
@ -126,7 +130,7 @@ function wptexturize($text, $reset = false) {
}
// Apostrophe in a word. No spaces, double apostrophes, or other punctuation.
if ( "'" != $apos ) {
if ( "'" !== $apos ) {
$dynamic[ '/(?<!' . $spaces . ')\'(?!\Z|[.,:;"\'(){}<>[\]\-]|' . $spaces . ')/' ] = $apos;
}
@ -151,7 +155,7 @@ function wptexturize($text, $reset = false) {
}
// Single quotes followed by spaces or ending punctuation.
if ( "'" != $closing_single_quote ) {
if ( "'" !== $closing_single_quote ) {
$dynamic[ '/\'(?=\Z|[.,)}>\-\]]|' . $spaces . ')/' ] = $closing_single_quote;
}