From c08d1a6dd4a3c2ba4be652fc81286de2c9b39101 Mon Sep 17 00:00:00 2001 From: tudacs Date: Fri, 10 Jun 2022 05:40:37 +0200 Subject: [PATCH] Add substitute to tests --- sigal/plugins/titleregexp.py | 2 +- tests/sample/sigal.conf.py | 2 +- tests/test_plugins.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sigal/plugins/titleregexp.py b/sigal/plugins/titleregexp.py index 9cda724..fe457ed 100644 --- a/sigal/plugins/titleregexp.py +++ b/sigal/plugins/titleregexp.py @@ -67,7 +67,7 @@ def titleregexp(album): if n>0 : for s in r.get('substitute', []) : - album.title = album.title.replace(r[0],r[1]) + album.title = album.title.replace(s[0],s[1]) if r.get('break','') != '' : break diff --git a/tests/sample/sigal.conf.py b/tests/sample/sigal.conf.py index 7fa39a0..338d472 100644 --- a/tests/sample/sigal.conf.py +++ b/tests/sample/sigal.conf.py @@ -42,7 +42,7 @@ atom_feed = {"feed_url": "http://127.0.0.1:8000/feed.atom", "nb_items": 10} titleregexp = { "regexp": [ - { "search": r"test ?(.*)", "replace": r"titleregexp \1" } + { "search": r"test ?(.*)", "replace": r"titleregexp \1", "substitute": [ [ "2", "02" ] ], "break": 1 } ] } diff --git a/tests/test_plugins.py b/tests/test_plugins.py index d067be9..6d0a08f 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -57,4 +57,4 @@ def test_titleregexp(settings, tmpdir, disconnect_signals): gal = Gallery(settings) gal.build() - assert gal.albums.get('dir1').albums[1].title == "titleregexp 2" + assert gal.albums.get('dir1').albums[1].title == "titleregexp 02"