Merge pull request #469 from tudacs/titleregexp
Another plugin: Titleregexp - modify titles of albums with regular expressions
This commit is contained in:
@@ -23,6 +23,7 @@ plugins = [
|
||||
"sigal.plugins.nomedia",
|
||||
"sigal.plugins.watermark",
|
||||
"sigal.plugins.zip_gallery",
|
||||
"sigal.plugins.titleregexp",
|
||||
]
|
||||
copyright = "© An example copyright message"
|
||||
adjust_options = {
|
||||
@@ -41,6 +42,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", "substitute": [ [ "2", "02" ] ], "break": 1 }
|
||||
]
|
||||
}
|
||||
|
||||
# theme = 'photoswipe'
|
||||
# theme = 'galleria'
|
||||
# thumb_size = (280, 210)
|
||||
|
||||
@@ -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 02"
|
||||
|
||||
Reference in New Issue
Block a user