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

Add replace_title write rule to adjust entry titles

This commit is contained in:
Magnus Åhall 2023-09-07 05:09:54 +02:00 committed by GitHub
parent a0ae5a6868
commit 69738bce84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 0 deletions

View file

@ -450,6 +450,22 @@ func TestRewriteReplaceCustom(t *testing.T) {
}
}
func TestRewriteReplaceTitleCustom(t *testing.T) {
controlEntry := &model.Entry{
Title: `Ouch, a thistle`,
Content: `The replace_title rewrite rule should not modify the content.`,
}
testEntry := &model.Entry{
Title: `A title`,
Content: `The replace_title rewrite rule should not modify the content.`,
}
Rewriter("https://example.org/article", testEntry, `replace_title("(?i)^a\\s*ti"|"Ouch, a this")`)
if !reflect.DeepEqual(testEntry, controlEntry) {
t.Errorf(`Not expected output: got "%+v" instead of "%+v"`, testEntry, controlEntry)
}
}
func TestRewriteRemoveCustom(t *testing.T) {
controlEntry := &model.Entry{
Title: `A title`,