Alter the regex in `wptexturize()` to properly handle input like: `<> "Hello world" <>`.

Updates unit test data.

Props miqrogroove.
Fixes #30344.


git-svn-id: https://develop.svn.wordpress.org/trunk@31965 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor 2015-04-01 19:08:31 +00:00
parent e4a9e49b6d
commit bcf98c7742
2 changed files with 13 additions and 1 deletions

View File

@ -235,7 +235,7 @@ function wptexturize($text, $reset = false) {
. '(?(?=!--)' // Is this a comment?
. $comment_regex // Find end of comment.
. '|'
. '[^>]+>' // Find end of element.
. '[^>]*>' // Find end of element.
. ')'
. '|'
. $shortcode_regex // Find shortcodes.

View File

@ -1393,6 +1393,18 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
'[Let\'s get crazy<input>[caption code="<a href=\'?a[]=100\'>hello</a>"]</input>world]', // caption shortcode is invalid here because it contains [] chars.
'[Let&#8217;s get crazy<input>[caption code=&#8221;<a href=\'?a[]=100\'>hello</a>&#8220;]</input>world]',
),
array(
'<> ... <>',
'<> &#8230; <>',
),
array(
'<> ... <> ... >',
'<> &#8230; <> &#8230; >',
),
array(
'<> ... < ... > ... <>',
'<> &#8230; < ... > &#8230; <>',
),
);
}