[wp-trac] [WordPress Trac] #30986: Consider using an abstract syntax tree for wpautop

WordPress Trac noreply at wordpress.org
Mon Jan 12 01:22:10 UTC 2015


#30986: Consider using an abstract syntax tree for wpautop
-------------------------+-----------------------------
 Reporter:  ericlewis    |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Formatting   |    Version:  0.71
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 `wpautop()`has a
 [https://core.trac.wordpress.org/query?status=accepted&status=assigned&status=new&status=reopened&status=reviewing&keywords=~wpautop&col=id&col=summary&col=status&col=owner&col=type&col=priority&col=milestone&order=priority
 bunch of problems].

 `wpautop()` uses basic string-manipulation to figure out where to put
 paragraph tags. I think, although this approach has gotten us pretty far,
 it may be the wrong approach in general. HTML is a loosely defined
 language, so a more robust tool might be a better fit.

 Browsers typically parse HTML into an
 [http://en.wikipedia.org/wiki/Abstract_syntax_tree abstract syntax tree]
 via lexical analysis. Here's
 [http://www.html5rocks.com/en/tutorials/internals/howbrowserswork/ more
 than you ever wanted to know on that topic by Tali Garsiel and Paul
 Irish].

 I wonder if this would be a more sturdy approach to auto-adding paragraph
 tags, and if there's existing WordPress-compatible software we could use.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30986>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list