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:
parent
de7a613098
commit
b8b6c74d86
3 changed files with 34 additions and 1 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue