diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-10-22 22:13:32 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-10-22 22:13:32 +0000 |
| commit | d4538340fdbe7016a7b3a2eb040c7b133df19efe (patch) | |
| tree | 2328d0d28772d730773904d435e04b80ae1b25ce /app/src/test/java/org/terst/feedreader/readability/UnrenderedTexTest.kt | |
| parent | 9bf135585885b043a05f3e74197314bdb4633c67 (diff) | |
Name a title-less feed item by its own opening words
RSS requires an item to carry a title or a description, not both, and
plenty of feeds take the second option. Mastodon's tag feeds are the
case that surfaced it: every one of the 20 items in
mastodon.social/tags/giftlink.rss has a description and no title at
all, so subscribing to one produced a list of blank rows with nothing
to read or tap.
A post says what it is, it just says it in the body, so the item is
now named by its own first sentence -- falling back to its opening
words when the sentence runs long, and to its link when there are no
words at all.
Two details that the live feed taught rather than the fixture:
Inline tags are removed without leaving a gap, and only block
boundaries become a space. Mastodon splits a hashtag as
`#<span>giftlink</span>` and a URL as `<span class="invisible">https://
</span><span>wapo.st/x</span>`, so turning every tag into a space tore
both apart -- first pass produced "# HumaneRights # USPolitics" and
"the loophole https:// wapo.".
A full stop only ends a sentence when whitespace or the end of the
text follows it, or the dot in "wapo.st/abc" ends it instead -- which
is how that same title got cut at "https://wapo.".
It also skips an opening fragment shorter than 20 characters: naming
an article "Wow." helps nobody.
Deliberately free of android.text.Html, unlike the parser's existing
entity decoding -- that pulls in the framework, which is why
FeedParser has no unit tests. This part does, 22 of them.
Verified on a device against the live feed: 20 items, 0 blank titles,
URLs and hashtags intact.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
Diffstat (limited to 'app/src/test/java/org/terst/feedreader/readability/UnrenderedTexTest.kt')
0 files changed, 0 insertions, 0 deletions
