wptexturize() should handle apostrophes before primes.

Props nacin, miqrogroove.
Fixes #22823.


git-svn-id: https://develop.svn.wordpress.org/trunk@28725 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2014-06-10 14:13:52 +00:00
parent da0b2f9769
commit 66b539bdab
2 changed files with 9 additions and 9 deletions

View File

@ -118,6 +118,11 @@ function wptexturize($text) {
$dynamic[ '/(?<=\A|[([{<"]|' . $spaces . ')\'/' ] = $opening_single_quote; $dynamic[ '/(?<=\A|[([{<"]|' . $spaces . ')\'/' ] = $opening_single_quote;
} }
// Apostrophe in a word. No spaces or double apostrophes.
if ( "'" != $apos ) {
$dynamic[ '/(?<!' . $spaces . ')\'(?!\Z|\'|' . $spaces . ')/' ] = $apos;
}
// 9" (double prime) // 9" (double prime)
if ( '"' !== $double_prime ) { if ( '"' !== $double_prime ) {
$dynamic[ '/(?<=\d)"/' ] = $double_prime; $dynamic[ '/(?<=\d)"/' ] = $double_prime;
@ -128,11 +133,6 @@ function wptexturize($text) {
$dynamic[ '/(?<=\d)\'/' ] = $prime; $dynamic[ '/(?<=\d)\'/' ] = $prime;
} }
// Apostrophe in a word. No spaces or double primes.
if ( "'" !== $apos ) {
$dynamic[ '/(?<!' . $spaces . ')\'(?!\'|' . $spaces . ')/' ] = $apos;
}
// Double quote at start, or preceded by (, {, <, [, or spaces, and not followed by spaces. // Double quote at start, or preceded by (, {, <, [, or spaces, and not followed by spaces.
if ( '"' !== $opening_quote ) { if ( '"' !== $opening_quote ) {
$dynamic[ '/(?<=\A|[([{<]|' . $spaces . ')"(?!' . $spaces . ')/' ] = $opening_quote; $dynamic[ '/(?<=\A|[([{<]|' . $spaces . ')"(?!' . $spaces . ')/' ] = $opening_quote;

View File

@ -500,16 +500,16 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
"word 99&#8242; word", "word 99&#8242; word",
), ),
array( array(
"word 99'word", "word 99'word", // Not a prime anymore. Apostrophes get priority.
"word 99&#8242;word", "word 99&#8217;word",
), ),
array( array(
"word99' word", "word99' word",
"word99&#8242; word", "word99&#8242; word",
), ),
array( array(
"word99'word", "word99'word", // Not a prime anymore.
"word99&#8242;word", "word99&#8217;word",
), ),
); );
} }