Opened 3 years ago

Last modified 14 months ago

#13340 new enhancement

wpautop breaks inline MathMl

Reported by: nicholaswilson Owned by:
Priority: normal Milestone: Future Release
Component: Formatting Version: 2.9.2
Severity: normal Keywords: has-patch 3.2-early gsoc needs-testing needs-unit-tests wpautop
Cc: nicholas@…, wojtek.szkutnik@…

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 3 years ago.

Download all attachments as: .zip

Change History (9)

  • Cc nicholas@… added
  • Keywords has-patch added

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

  • Cc wojtek.szkutnik@… added
  • Keywords gsoc added
  • 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.

  • Milestone changed from Awaiting Review to 3.1

This looks straightforward.

  • 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.

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