The "Convert line breaks" filter should recognize non-self closing br tags (<br>). Currently it only recognizes self closing br tags (<br />).

Patch to follow.

Comments

loopduplicate created an issue. See original summary.

loopduplicate’s picture

Assigned: loopduplicate » Unassigned
Status: Active » Needs review
StatusFileSize
new1.78 KB

Here's a patch for D7.

Might need a test.
Needs D8 version.

Status: Needs review » Needs work

The last submitted patch, 2: core-br-filter-autop-2945412-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

loopduplicate’s picture

Assigned: Unassigned » loopduplicate

Darn. I'm working on it.

loopduplicate’s picture

Assigned: loopduplicate » Unassigned
Status: Needs work » Needs review
StatusFileSize
new733 bytes
new2.5 KB

Here's a test and a new patch.

The last submitted patch, 5: core-br-filter-autop-2945412-5-test-only.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

loopduplicate’s picture

Status: Needs review » Needs work

This passes tests but something appears wonky. Marking as needs work for now.

emacoti’s picture

I was testing the latest patch and saw the wonky behavior. After some more testing and debugging I found that the line 1750 have an issue with the regular expression. Fixed so it recognize both tags correctly. After some testing I can see it working fine with the fix.

emacoti’s picture

Status: Needs work » Needs review
StatusFileSize
new2.52 KB

Attached the patch.

daggerhart’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new20.44 KB
new19.3 KB

This applies cleanly and solves the issue.

I pasted the test code into 2 sites, one with the patch applied and one without.

Without Patch:

unpatched example

With Patch:

patched example

Thanks!

poker10’s picture

Status: Reviewed & tested by the community » Postponed
Parent issue: » #2350049: filter_autop() returns <br /> but should return <br> for HTML5
Related issues: +#3005630: Port _filter_autop() changes from D8 to D7

Thanks for reporting this. This is not in D10 yet, therefore according to the backport policy, we must postpone this on: #2350049: filter_autop() returns <br /> but should return <br> for HTML5

In the meantime, we can finish the D10 backport to include all other HTML5 block tags, see: #3005630: Port _filter_autop() changes from D8 to D7

Status: Postponed » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.