1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-09-15 18:57:04 +00:00

feat(rewrite): add a rule to remove useless heading images on phoronix

This commit is contained in:
jvoisin 2025-07-30 14:05:12 +02:00 committed by Frédéric Guillot
parent 240ec8bd0a
commit 9eea9873b5
2 changed files with 20 additions and 0 deletions

View file

@ -797,6 +797,23 @@ func TestRewriteRemoveCustom(t *testing.T) {
t.Errorf(`Not expected output: got "%+v" instead of "%+v"`, testEntry, controlEntry)
}
}
func TestRewriteRemoveQuotedSelector(t *testing.T) {
controlEntry := &model.Entry{
URL: "https://example.org/article",
Title: `A title`,
Content: `<div>Lorem Ipsum</div>`,
}
testEntry := &model.Entry{
URL: "https://example.org/article",
Title: `A title`,
Content: `<div>Lorem Ipsum<img alt="LINUX KERNEL" src="/assets/categories/linuxkernel.webp" width="100" height="100"></div>`,
}
ApplyContentRewriteRules(testEntry, `remove("img[src^='/assets/categories/']")`)
if !reflect.DeepEqual(testEntry, controlEntry) {
t.Errorf(`Not expected output: got "%+v" instead of "%+v"`, testEntry, controlEntry)
}
}
func TestRewriteAddCastopodEpisode(t *testing.T) {
controlEntry := &model.Entry{