[wp-trac] [WordPress Trac] #2833: wpautop breaks style and script tags

WordPress Trac noreply at wordpress.org
Tue Apr 23 20:17:12 UTC 2019


#2833: wpautop breaks style and script tags
--------------------------------------------+-----------------------------
 Reporter:  Nazgul                          |       Owner:  (none)
     Type:  defect (bug)                    |      Status:  reopened
 Priority:  low                             |   Milestone:  Future Release
Component:  Formatting                      |     Version:  2.0.3
 Severity:  normal                          |  Resolution:
 Keywords:  wpautop has-patch dev-feedback  |     Focuses:
--------------------------------------------+-----------------------------

Comment (by azaozz):

 Replying to [comment:36 aduth]:
 > @cmmarslender patch at attachment:2833.2.diff :
 >
 > - This resolves both issues of `br` elements and `p` elements insertion.
 In fact, it resolves it so well it should also include removal of the
 previous attempts to fix the issue added in r3965 (it's no longer
 necessary to create the temporary `WPPreserveNewline`)

 Yeah, the method used in 2833.2.diff (excluding the whole script tag from
 "processing") should work best.

 > Another issue I'd encountered -- not reflected in an patches here -- is
 that script tags are wrongly ''wrapped'' in a `p` tag:
 > ...
 > As best I can tell, the resolution here is to include `script` in the
 set of `$allblocks`

 That would mean they will always be "pulled out" on a new line, even when
 inside other tags. That may result in unwanted `<p>` after `</script>`.
 Another option would be to remove leading line breaks before
 `<script...>`. This can still bring edge cases but perhaps less often. Not
 really sure what's the "lesser evil" here :)

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/2833#comment:37>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list