WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 2 years ago

#13340 new enhancement

wpautop breaks inline MathMl

Reported by: nicholaswilson Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 2.9.2
Component: Formatting Keywords: has-patch 3.2-early gsoc needs-testing needs-unit-tests wpautop
Focuses: Cc:

Description

wpautop treats inline <math> tags as block; they in fact may be placed block or inline, with their flow model dependent on the mode or CSS display property.

Trivial to fix; just needs someone to commit the change. Remove "|math" from $allblocks in file wp-includes/formatting.php. math tags on their own will be wrapped in a paragraph, which is fine.

As a very convenient enhancement, please replace on line 210:

     if ($br) {
-        $pee = preg_replace_callback('/<(script|style). ....
+        $pee = preg_replace_callback('/<(script|style|math) ...

to prevent MathML being polluted with breaks (current required workaround people are using is to have the whole block on one line, which is very messy to edit).

Attachments (1)

13340.diff (1.8 KB) - added by wojtek.szkutnik 4 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 nicholaswilson4 years ago

  • Cc nicholas@… added

wojtek.szkutnik4 years ago

comment:2 wojtek.szkutnik4 years ago

  • Keywords has-patch added

Adding the patch. All looks pretty straightforward to me, shouldn't break anything.

comment:3 wojtek.szkutnik4 years ago

  • Cc wojtek.szkutnik@… added

comment:4 wojtek.szkutnik4 years ago

  • Keywords gsoc added

comment:5 hakre4 years ago

  • Keywords needs-testing needs-unit-tests added

wpautop() related/informative tickets:

Related: #1706
Related: #2833
Related: #3007
Related: #3833
Related: #4857
Related: #4298
Related: #5250
Related: #6984
Related: #7988
Related: #9437
Related: #10033
Related: #10490
Related: #11678
Related: #12061
Related: #13327

Informative: #7937
Informative: #9744

AutoP tickets get only fixed in very specific situations. In any case they need extensive testing because of backward compabilities and side-effects and therefore normally Unit-Tests.

comment:6 nacin3 years ago

  • Milestone changed from Awaiting Review to 3.1

This looks straightforward.

comment:7 nacin3 years ago

  • Keywords 3.2-early added
  • Milestone changed from 3.1 to Future Release
  • Type changed from defect (bug) to enhancement

Not knowing anything about MatML, I want confirmation before doing anything like this.

enhancements can go to 3.2.

comment:8 WraithKenny2 years ago

  • Keywords wpautop added
Note: See TracTickets for help on using tickets.