Changeset 55272
- Timestamp:
- 02/07/2023 04:16:47 PM (4 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r55245 r55272 481 481 $text = preg_replace( '|<br\s*/?>\s*<br\s*/?>|', "\n\n", $text ); 482 482 483 $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address| math|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)';483 $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|form|map|area|blockquote|address|style|p|h[1-6]|hr|fieldset|legend|section|article|aside|hgroup|header|footer|nav|figure|figcaption|details|menu|summary)'; 484 484 485 485 // Add a double line break above block-level opening tags. … … 569 569 if ( $br ) { 570 570 // Replace newlines that shouldn't be touched with a placeholder. 571 $text = preg_replace_callback( '/<(script|style|svg ).*?<\/\\1>/s', '_autop_newline_preservation_helper', $text );571 $text = preg_replace_callback( '/<(script|style|svg|math).*?<\/\\1>/s', '_autop_newline_preservation_helper', $text ); 572 572 573 573 // Normalize <br> -
trunk/tests/phpunit/tests/formatting/wpAutop.php
r53687 r55272 106 106 107 107 /** 108 * wpautop() Should add <p> around inline "<math>" elements. 109 * 110 * @ticket 13340 111 */ 112 public function test_wrap_inline_math_elements() { 113 $str = '<math><mrow><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup><mo>=</mo><msup><mi>c</mi><mn>2</mn></msup></mrow></math>'; 114 115 $this->assertSame( "<p>$str</p>", trim( wpautop( $str ) ) ); 116 } 117 118 /** 119 * wpautop() Should not add <br> inside block "<math>" elements. 120 * 121 * @ticket 13340 122 */ 123 public function test_skip_block_math_elements() { 124 $str = '<math display="block"> 125 <mtable> 126 <mtr> 127 <mtd> 128 <msup><mrow><mo>(</mo><mi>a</mi><mo>+</mo><mi>b</mi><mo>)</mo></mrow><mn>2</mn></msup> 129 </mtd> 130 <mtd> 131 <mo>=</mo> 132 </mtd> 133 <mtd> 134 <msup><mi>c</mi><mn>2</mn></msup> 135 <mo>+</mo><mn>4</mn><mo>⋅</mo> 136 <mo>(</mo><mfrac><mn>1</mn><mn>2</mn></mfrac><mi>a</mi><mi>b</mi><mo>)</mo> 137 </mtd> 138 </mtr> 139 <mtr> 140 <mtd> 141 <msup><mi>a</mi><mn>2</mn></msup> 142 <mo>+</mo><mn>2</mn><mi>a</mi><mi>b</mi><mo>+</mo> 143 <msup><mi>b</mi><mn>2</mn></msup> 144 </mtd> 145 <mtd> 146 <mo>=</mo> 147 </mtd> 148 <mtd> 149 <msup><mi>c</mi><mn>2</mn></msup> 150 <mo>+</mo><mn>2</mn><mi>a</mi><mi>b</mi> 151 </mtd> 152 </mtr> 153 <mtr> 154 <mtd><msup><mi>a</mi><mn>2</mn></msup><mo>+</mo><msup><mi>b</mi><mn>2</mn></msup></mtd> 155 <mtd><mo>=</mo></mtd> 156 <mtd><msup><mi>c</mi><mn>2</mn></msup></mtd> 157 </mtr> 158 </mtable> 159 </math>'; 160 161 $this->assertSame( "<p>$str</p>", trim( wpautop( $str ) ) ); 162 } 163 164 /** 108 165 * wpautop() Should not add <p> and <br/> around <source> and <track> 109 166 * … … 309 366 'area', 310 367 'address', 311 'math',312 368 'style', 313 369 'p',
Note: See TracChangeset
for help on using the changeset viewer.