Opened 13 years ago
Closed 13 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.
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).