When a hyphen -
or double hyphen --
was at the start or the end of a string, it wasn't texturized correctly.
Fixes #31030 git-svn-id: https://develop.svn.wordpress.org/trunk@31199 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
d266ecd5b2
commit
c8c8b66bae
@ -174,9 +174,9 @@ function wptexturize($text, $reset = false) {
|
|||||||
|
|
||||||
// Dashes and spaces
|
// Dashes and spaces
|
||||||
$dynamic[ '/---/' ] = $em_dash;
|
$dynamic[ '/---/' ] = $em_dash;
|
||||||
$dynamic[ '/(?<=' . $spaces . ')--(?=' . $spaces . ')/' ] = $em_dash;
|
$dynamic[ '/(?<=^|' . $spaces . ')--(?=$|' . $spaces . ')/' ] = $em_dash;
|
||||||
$dynamic[ '/(?<!xn)--/' ] = $en_dash;
|
$dynamic[ '/(?<!xn)--/' ] = $en_dash;
|
||||||
$dynamic[ '/(?<=' . $spaces . ')-(?=' . $spaces . ')/' ] = $en_dash;
|
$dynamic[ '/(?<=^|' . $spaces . ')-(?=$|' . $spaces . ')/' ] = $en_dash;
|
||||||
|
|
||||||
$dynamic_characters['dash'] = array_keys( $dynamic );
|
$dynamic_characters['dash'] = array_keys( $dynamic );
|
||||||
$dynamic_replacements['dash'] = array_values( $dynamic );
|
$dynamic_replacements['dash'] = array_values( $dynamic );
|
||||||
|
@ -208,6 +208,19 @@ class Tests_Formatting_WPTexturize extends WP_UnitTestCase {
|
|||||||
$this->assertEquals( "$nbsp— ", wptexturize( "$nbsp-- ") );
|
$this->assertEquals( "$nbsp— ", wptexturize( "$nbsp-- ") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ticket 31030
|
||||||
|
*/
|
||||||
|
function test_hyphens_at_start_and_end() {
|
||||||
|
$this->assertEquals( '– ', wptexturize( '- ' ) );
|
||||||
|
$this->assertEquals( '– –', wptexturize( '- -' ) );
|
||||||
|
$this->assertEquals( ' –', wptexturize( ' -' ) );
|
||||||
|
|
||||||
|
$this->assertEquals( '— ', wptexturize( '-- ' ) );
|
||||||
|
$this->assertEquals( '— —', wptexturize( '-- --' ) );
|
||||||
|
$this->assertEquals( ' —', wptexturize( ' --' ) );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test spaces around quotes.
|
* Test spaces around quotes.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user