blob: decddc6a6d10e5142a9f275c248f1ec07433aed7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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))
}
|