Manual diff to http://ma.tt/scripts/autop/ approx. results in attached patch.

Comments

sun’s picture

+++ modules/filter/filter.module	2 Sep 2010 21:35:15 -0000
@@ -1567,6 +1567,7 @@ function _filter_autop($text) {
+      $chunk = str_replace(array("\r\n", "\r"), "\n", $chunk); // cross-platform newlines

This is done once for all filters by http://api.drupal.org/api/function/check_markup/7 already.

Powered by Dreditor.

carlos8f’s picture

I don't think we should keep using WordPress's function. It consistently outputs invalid XHTML because its mechanism is primitive and not mindful of the rules of nesting or even closing the p tags it has opened. In WordPress that is kept in check by using a hard-coded HTML corrector at all times. In Drupal that doesn't really work because we can't create filter dependencies. I'd like to make this a won't fix.

sun’s picture

Version: 7.x-dev » 8.x-dev
kscheirer’s picture

Status: Needs review » Needs work
quicksketch’s picture

Status: Needs work » Fixed

Between @sun's comment in #1 and mfer's patch in #1280522: _filter_autop (line break converter) does not recognize html5 block level elements. This issue is effectively fixed.

quicksketch’s picture

Status: Fixed » Needs work

Hm actually not true. Still isn't updated to include fieldset|legend, plus the addition of dl|dd|dt.

I don't think we should keep using WordPress's function. It consistently outputs invalid XHTML because its mechanism is primitive and not mindful of the rules of nesting or even closing the p tags it has opened.

Until we remove autop, we should attempt to make it as unbroken as possible. Current attempts to convert the HTML parsing to DOM (#659580: Specify what the line break converter should do and rewrite it in DOM) have been stuck for years.

quicksketch’s picture

Status: Needs work » Needs review
StatusFileSize
new1.56 KB

Reroll.

Adds missing block tags:
col
option
map
area
math
input
fieldset
legend

Intentionally does not add "style" since we have separate processing code for it already.

In the $chunk section, it adds support for dl, dd, and dt.

quicksketch’s picture

Title: Update Line break filter to latest WP version » Update autop filter to include missing block level tags
Category: task » bug

Perhaps removing WP from the title will increase the palatability of this issue. :P

quicksketch’s picture

If fixed this issue will effectively solve #653988: Line break filter corrupts existing XHTML

sun’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +html5

It would have been nice to keep the order of elements identical to WP's autop filter as in #0, so as to simplify future diffs between the libraries...

But anyway, this is good to go.

We could consider a backport, but OTOH, #1280522: _filter_autop (line break converter) does not recognize html5 block level elements wasn't backported either, and I can only guess that various other issues are missing, too. So let's rather leave it alone.

sun’s picture

#7: filter_autop_update-900956.patch queued for re-testing.

quicksketch’s picture

It would have been nice to keep the order of elements identical to WP's autop filter as in #0, so as to simplify future diffs between the libraries...

Yeah agreed... but #1280522: _filter_autop (line break converter) does not recognize html5 block level elements added the new tags in arbitrary locations so I kept them in the new order to make diff'ing this particular patch easier. Thanks for RTBC'ing this.

dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x. Thanks.

Status: Fixed » Closed (fixed)
Issue tags: -html5

Automatically closed -- issue fixed for 2 weeks with no activity.