Changeset 28726
- Timestamp:
- 06/10/2014 02:21:36 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r28725 r28726 92 92 } 93 93 94 $static_characters = array_merge( array( ' ---', '...', '``', '\'\'', ' (tm)' ), $cockney );95 $static_replacements = array_merge( array( $em_dash,'…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace );94 $static_characters = array_merge( array( '...', '``', '\'\'', ' (tm)' ), $cockney ); 95 $static_replacements = array_merge( array( '…', $opening_quote, $closing_quote, ' ™' ), $cockneyreplace ); 96 96 97 97 $spaces = wp_spaces_regexp(); … … 114 114 } 115 115 116 // Single quote at start, or preceded by (, {, <, [, ", or spaces.116 // Single quote at start, or preceded by (, {, <, [, ", -, or spaces. 117 117 if ( "'" !== $opening_single_quote ) { 118 $dynamic[ '/(?<=\A|[([{<" ]|' . $spaces . ')\'/' ] = $opening_single_quote;118 $dynamic[ '/(?<=\A|[([{<"\-]|' . $spaces . ')\'/' ] = $opening_single_quote; 119 119 } 120 120 … … 134 134 } 135 135 136 // Double quote at start, or preceded by (, {, <, [, or spaces, and not followed by spaces.136 // Double quote at start, or preceded by (, {, <, [, -, or spaces, and not followed by spaces. 137 137 if ( '"' !== $opening_quote ) { 138 $dynamic[ '/(?<=\A|[([{< ]|' . $spaces . ')"(?!' . $spaces . ')/' ] = $opening_quote;138 $dynamic[ '/(?<=\A|[([{<\-]|' . $spaces . ')"(?!' . $spaces . ')/' ] = $opening_quote; 139 139 } 140 140 … … 150 150 151 151 // Dashes and spaces 152 $dynamic[ '/---/' ] = $em_dash; 152 153 $dynamic[ '/(?<=' . $spaces . ')--(?=' . $spaces . ')/' ] = $em_dash; 153 154 $dynamic[ '/(?<!xn)--/' ] = $en_dash; -
trunk/tests/phpunit/tests/formatting/WPTexturize.php
r28725 r28726 1067 1067 } 1068 1068 1069 /** 1070 * Quotations should be allowed to have dashes around them. 1071 * 1072 * @ticket 20342 1073 * @dataProvider data_quotes_and_dashes 1074 */ 1075 function test_quotes_and_dashes( $input, $output ) { 1076 return $this->assertEquals( $output, wptexturize( $input ) ); 1077 } 1078 1079 function data_quotes_and_dashes() { 1080 return array( 1081 array( 1082 'word---"quote"', 1083 'word—“quote”', 1084 ), 1085 array( 1086 'word--"quote"', 1087 'word–“quote”', 1088 ), 1089 array( 1090 'word-"quote"', 1091 'word-“quote”', 1092 ), 1093 array( 1094 "word---'quote'", 1095 "word—‘quote’", 1096 ), 1097 array( 1098 "word--'quote'", 1099 "word–‘quote’", 1100 ), 1101 array( 1102 "word-'quote'", 1103 "word-‘quote’", 1104 ), 1105 array( 1106 '"quote"---word', 1107 '“quote”—word', 1108 ), 1109 array( 1110 '"quote"--word', 1111 '“quote”–word', 1112 ), 1113 array( 1114 '"quote"-word', 1115 '“quote”-word', 1116 ), 1117 array( 1118 "'quote'---word", 1119 "‘quote’—word", 1120 ), 1121 array( 1122 "'quote'--word", 1123 "‘quote’–word", 1124 ), 1125 array( 1126 "'quote'-word", 1127 "‘quote’-word", 1128 ), 1129 ); 1130 } 1069 1131 }
Note: See TracChangeset
for help on using the changeset viewer.