From ff2c79ca6d5f82acc36f654631692282c7ac7a45 Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Mon, 19 Jan 2015 23:42:47 +0100 Subject: [PATCH] Allow to specify the author of an album (ref #139). The author can be set in the album's index.md or in the settings. --- sigal/gallery.py | 5 +++++ sigal/themes/colorbox/templates/index.html | 6 +++--- sigal/themes/galleria/templates/index.html | 4 ++-- tests/sample/sigal.conf.py | 1 + 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/sigal/gallery.py b/sigal/gallery.py index ceb35df..da9fecc 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -281,6 +281,11 @@ class Album(UnicodeMixin): for key, val in meta.items(): setattr(self, key, val) + try: + self.author = self.meta['author'][0] + except KeyError: + self.author = self.settings.get('author') + def create_output_directories(self): """Create output directories for thumbnails and original images.""" check_or_create_dir(self.dst_path) diff --git a/sigal/themes/colorbox/templates/index.html b/sigal/themes/colorbox/templates/index.html index 2fb0488..413f367 100644 --- a/sigal/themes/colorbox/templates/index.html +++ b/sigal/themes/colorbox/templates/index.html @@ -6,7 +6,7 @@ {{ album.title }} - + @@ -30,7 +30,7 @@ {% endif %} @@ -91,7 +91,7 @@ {% if 'sigal.plugins.media_page' in settings.plugins %} + data-href="{{ media.filename }}" {{ img_description(media) }}> {% else %} {% endif %} diff --git a/sigal/themes/galleria/templates/index.html b/sigal/themes/galleria/templates/index.html index 523e841..421c9e8 100644 --- a/sigal/themes/galleria/templates/index.html +++ b/sigal/themes/galleria/templates/index.html @@ -6,7 +6,7 @@ {{ album.title|striptags }} - + @@ -113,7 +113,7 @@ diff --git a/tests/sample/sigal.conf.py b/tests/sample/sigal.conf.py index f5bdabb..34bb333 100644 --- a/tests/sample/sigal.conf.py +++ b/tests/sample/sigal.conf.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +author = 'John Doe' title = u"Sigal test gallery ☺" source = 'pictures' thumb_suffix = '.tn'