Convert <br> tags to spaces in API-provided excerpts - #25875
Open
crazytonyli wants to merge 2 commits into
Open
Conversation
The break-aware excerpt handling added in #25392 only ran when a summary was generated from post content. Reader posts almost always carry an API-provided excerpt, and formatSummary stripped its tags with an empty replacement, so <br>-separated words ran together (e.g. "Yes,<br>look behind" rendered as "Yes,look behind"). Extract the generator's break-aware plain-text conversion into GutenbergExcerptGenerator.singleLinePlainText(from:), bridge it to Objective-C as wpkit_makeSingleLinePlainText, and use it when formatting API-provided excerpts. Titles and site metadata keep the generic plain-text conversion. Note: WordPress.com pre-strips <br> when it auto-generates an excerpt from post content, so this only repairs author-set excerpts; the auto-generated case is mangled server-side before the app sees it.
formatSummary always returns a non-nil string, so the nil check guarding the createSummaryFromContent fallback never fired: posts whose API excerpt was empty ended up with an empty summary instead of one crafted from the post content, and the content-based generator integrated in #25392 was unreachable on the Reader path. Check for an empty string instead of nil so the fallback works as documented.
Contributor
|
| App Name | WordPress | |
| Configuration | Release-Alpha | |
| Build Number | 33648 | |
| Version | PR #25875 | |
| Bundle ID | org.wordpress.alpha | |
| Commit | 1648b59 | |
| Installation URL | 1lv3ofisb474g |
Contributor
|
| App Name | Jetpack | |
| Configuration | Release-Alpha | |
| Build Number | 33648 | |
| Version | PR #25875 | |
| Bundle ID | com.jetpack.alpha | |
| Commit | 1648b59 | |
| Installation URL | 1j3dbitfn2kno |
crazytonyli
enabled auto-merge
August 7, 2026 03:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Description
Relates to #25392. Reader posts almost always carry an API-provided excerpt, and
formatSummarystripped its HTML with a plain tag stripper, so<br>-separated words still ran together in the feed.To reproduce the issue: publish a post with an author-set excerpt containing a
<br>tag (e.g.Yes,<br>look behind), then view it in the Reader feed. The cell shows "Yes,look behind". This only reproduces with author-set excerpts; WordPress.com strips<br>server-side when it auto-generates an excerpt from post content, which a client-side fix can't repair.