diff options
Diffstat (limited to 'app/src/main/java/org/terst/feedreader/readability/ArticleLitter.kt')
| -rw-r--r-- | app/src/main/java/org/terst/feedreader/readability/ArticleLitter.kt | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/src/main/java/org/terst/feedreader/readability/ArticleLitter.kt b/app/src/main/java/org/terst/feedreader/readability/ArticleLitter.kt new file mode 100644 index 0000000..decddc6 --- /dev/null +++ b/app/src/main/java/org/terst/feedreader/readability/ArticleLitter.kt @@ -0,0 +1,24 @@ +package org.terst.feedreader.readability + +/** + * Everything that gets cleaned out of an extracted article body, in one call. + * + * There are two places a body is cleaned -- a fresh extraction on its way out of [EvalDecision], + * and a cached one on its way back in through `loadCachedExtraction` -- and they must stay in + * step. A cached article is cleaned in place rather than discarded, so a cleaner wired into only + * the fresh path would leave every already-read article carrying litter that nothing would ever + * remove: the body is good, so it is never re-fetched. + * + * Hence one entry point rather than a list of calls repeated at both sites. Adding a cleaner here + * reaches both; adding one to a call site reaches one, and which one it misses would depend on + * which file was open at the time. + * + * None of these discard an article. They remove things from inside it, which is why they sit + * apart from [ConsentNotice] and [UnrenderedTex] -- those two decide a body is not worth keeping. + */ +object ArticleLitter { + + /** [html] with the publisher's promo furniture removed. */ + fun strip(html: String?): String? = + PreferredSourceBadge.strip(RecirculationWidgets.strip(html)) +} |
