Allow 8212/8211 (em dash and en dash) to be translated in wptexturize(). props SergeyBiryukov, fixes #15556.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19187 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8284ef87fb
commit
524284fd6b
|
@ -28,7 +28,7 @@
|
|||
*/
|
||||
function wptexturize($text) {
|
||||
global $wp_cockneyreplace;
|
||||
static $opening_quote, $closing_quote, $default_no_texturize_tags, $default_no_texturize_shortcodes, $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements;
|
||||
static $opening_quote, $closing_quote, $en_dash, $em_dash, $default_no_texturize_tags, $default_no_texturize_shortcodes, $static_characters, $static_replacements, $dynamic_characters, $dynamic_replacements;
|
||||
|
||||
// No need to set up these static variables more than once
|
||||
if ( empty( $opening_quote ) ) {
|
||||
|
@ -36,6 +36,10 @@ function wptexturize($text) {
|
|||
$opening_quote = _x('“', 'opening curly quote');
|
||||
/* translators: closing curly quote */
|
||||
$closing_quote = _x('”', 'closing curly quote');
|
||||
/* translators: en dash */
|
||||
$en_dash = _x('–', 'en dash');
|
||||
/* translators: em dash */
|
||||
$em_dash = _x('—', 'em dash');
|
||||
|
||||
$default_no_texturize_tags = array('pre', 'code', 'kbd', 'style', 'script', 'tt');
|
||||
$default_no_texturize_shortcodes = array('code');
|
||||
|
@ -49,8 +53,8 @@ function wptexturize($text) {
|
|||
$cockneyreplace = array("’tain’t","’twere","’twas","’tis","’twill","’til","’bout","’nuff","’round","’cause");
|
||||
}
|
||||
|
||||
$static_characters = array_merge(array('---', ' -- ', '--', ' - ', 'xn–', '...', '``', '\'\'', ' (tm)'), $cockney);
|
||||
$static_replacements = array_merge(array('—', ' — ', '–', ' – ', 'xn--', '…', $opening_quote, $closing_quote, ' ™'), $cockneyreplace);
|
||||
$static_characters = array_merge( array('---', ' -- ', '--', ' - ', 'xn–', '...', '``', '\'\'', ' (tm)'), $cockney );
|
||||
$static_replacements = array_merge( array($em_dash, ' ' . $em_dash . ' ', $en_dash, ' ' . $en_dash . ' ', 'xn--', '…', $opening_quote, $closing_quote, ' ™'), $cockneyreplace );
|
||||
|
||||
$dynamic_characters = array('/\'(\d\d(?:’|\')?s)/', '/\'(\d)/', '/(\s|\A|[([{<]|")\'/', '/(\d)"/', '/(\d)\'/', '/(\S)\'([^\'\s])/', '/(\s|\A|[([{<])"(?!\s)/', '/"(\s|\S|\Z)/', '/\'([\s.]|\Z)/', '/\b(\d+)x(\d+)\b/');
|
||||
$dynamic_replacements = array('’$1','’$1', '$1‘', '$1″', '$1′', '$1’$2', '$1' . $opening_quote . '$2', $closing_quote . '$1', '’$1', '$1×$2');
|
||||
|
|
Loading…
Reference in New Issue