diff --git a/tests/sample/sigal.conf.py b/tests/sample/sigal.conf.py index 4a7041a..7fa39a0 100644 --- a/tests/sample/sigal.conf.py +++ b/tests/sample/sigal.conf.py @@ -21,6 +21,7 @@ plugins = [ "sigal.plugins.nomedia", "sigal.plugins.watermark", "sigal.plugins.zip_gallery", + "sigal.plugins.titleregexp", ] copyright = "© An example copyright message" adjust_options = { @@ -39,6 +40,12 @@ thumb_size = (200, 150) rss_feed = {"feed_url": "http://127.0.0.1:8000/feed.rss", "nb_items": 10} atom_feed = {"feed_url": "http://127.0.0.1:8000/feed.atom", "nb_items": 10} +titleregexp = { + "regexp": [ + { "search": r"test ?(.*)", "replace": r"titleregexp \1" } + ] +} + # theme = 'photoswipe' # theme = 'galleria' # thumb_size = (280, 210) diff --git a/tests/test_plugins.py b/tests/test_plugins.py index e1c5e87..d067be9 100644 --- a/tests/test_plugins.py +++ b/tests/test_plugins.py @@ -47,3 +47,14 @@ def test_nonmedia_files(settings, tmpdir, disconnect_signals): settings['destination'], 'nonmedia_files', 'thumbnails', 'dummy.tn.jpg' ) assert os.path.isfile(outthumb) + +def test_titleregexp(settings, tmpdir, disconnect_signals): + + if "sigal.plugins.titleregexp" not in settings["plugins"]: + settings['plugins'] += ["sigal.plugins.titleregexp"] + + init_plugins(settings) + gal = Gallery(settings) + gal.build() + + assert gal.albums.get('dir1').albums[1].title == "titleregexp 2"