1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

Add rewrite rule replace for custom search and replace

This commit is contained in:
Pacman99 2020-11-25 14:51:54 -08:00 committed by fguillot
parent de7a613098
commit b8b6c74d86
3 changed files with 34 additions and 1 deletions

View file

@ -230,3 +230,13 @@ func TestRewriteNoScriptImageWithNoScriptTag(t *testing.T) {
t.Errorf(`Not expected output: %s`, output)
}
}
func TestRewriteReplaceCustom(t *testing.T) {
content := `<img src="http://example.org/logo.svg"><img src="https://example.org/article/picture.svg">`
expected := `<img src="http://example.org/logo.svg"><img src="https://example.org/article/picture.png">`
output := Rewriter("https://example.org/artcle", content, `replace("article/(.*).svg"|"article/$1.png")`)
if expected != output {
t.Errorf(`Not expected output: %s`, output)
}
}