WordPress.org

Make WordPress Core

Opened 2 years ago

Closed 2 years ago

#20278 closed defect (bug) (duplicate)

Fix for TestPostFiltering::test_post_content_unbalanced_* tests

Reported by: devesine Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Formatting Keywords: has-patch
Focuses: Cc:

Description

The following tests do not currently pass:

TestPostFiltering::test_post_content_unbalanced_more
TestPostFiltering::test_post_content_unbalanced_nextpage
TestPostFiltering::test_post_content_unbalanced_more_nextpage
TestPostFiltering::test_post_content_unbalanced_nextpage_more

due to balanceTags simply running force_balance_tags against the text passed in to it from various _save_pre hooks.

The tests expect that balanceTags should balance tags separately on either side of <!--more--> and <!--nextpage--> quicktags, rather than in one lump.

The attached patch splits up the text (using a regex patterned after the regexes used to split out quicktags in other areas such as get_the_content()) runs force_balance_tags against each part, and glues them back together.

Attachments (1)

balanceTags_quicktags-trunk.patch (825 bytes) - added by devesine 2 years ago.

Download all attachments as: .zip

Change History (5)

comment:1 devesine2 years ago

This could be done in force_balance_tags instead, but my first thought is that force_balance_tags is a lower-level function; since it ignores options (use_balanceTags) and has no option to not balance (truism), it should ignore other WordPress-specific conceits like quicktags. Among other things, there's no expectation that it's always being used for content that should respect those quicktags (it's also used on the comment_text filter and in get_the_content() after the more and nextpage quicktags have been handled).

comment:2 devesine2 years ago

  • Keywords has-patch added

comment:3 nacin2 years ago

Nice!

comment:4 nacin2 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Actually, this is a duplicate of #6297. Could you post your patch there?

Note: See TracTickets for help on using tickets.