grand SIGAL_ => SIGLICAN_ transmogrification

This commit is contained in:
sawall 2014-10-03 02:10:57 -05:00
parent bbd78a83a9
commit b0fc5083d9
7 changed files with 118 additions and 118 deletions

View file

@ -5,8 +5,8 @@ A static gallery generator plugin for Pelican, based on the Sigal
Colorbox/Galleria static site generator. Colorbox/Galleria static site generator.
##How To ##How To
1. Put the contents of this folder into your Pelican plugins directory. Add 1. Put this folder into your Pelican plugins directory. Add 'siglican' to
'siglican' to PLUGINS in pelicanconf.py. PLUGINS in pelicanconf.py.
2. Create a 'siglican' directory in your base directory, at the same level as 2. Create a 'siglican' directory in your base directory, at the same level as
'content'. Drag 'colorbox' or 'galleria' from the 'themes' directory into 'content'. Drag 'colorbox' or 'galleria' from the 'themes' directory into
this folder. Also create an 'images' subdirectory under 'siglican'. this folder. Also create an 'images' subdirectory under 'siglican'.
@ -30,9 +30,11 @@ Example directory tree:
/templates/album.html /templates/album.html
``` ```
##Pelican settings
## To Do ## To Do
1. Update galleria theme to work. 1. Update galleria theme to work.
2. Change settings names to something other than SIGAL_* 2. Change settings names to something other than SIGLICAN_*
3. Unit tests. 3. Unit tests.
4. Logging cleanup. 4. Logging cleanup.
5. Update colorbox/galleria example themes to deal better with nested albums. 5. Update colorbox/galleria example themes to deal better with nested albums.

View file

@ -62,11 +62,11 @@ class Media(UnicodeMixin):
self.path = path self.path = path
self.settings = settings self.settings = settings
self.src_path = os.path.join(settings['SIGAL_SOURCE'], path, filename) self.src_path = os.path.join(settings['SIGLICAN_SOURCE'], path, filename)
self.dst_path = os.path.join(settings['SIGAL_DESTINATION'], path, filename) self.dst_path = os.path.join(settings['SIGLICAN_DESTINATION'], path, filename)
self.thumb_name = get_thumb(self.settings, self.filename) self.thumb_name = get_thumb(self.settings, self.filename)
self.thumb_path = os.path.join(settings['SIGAL_DESTINATION'], path, self.thumb_name) self.thumb_path = os.path.join(settings['SIGLICAN_DESTINATION'], path, self.thumb_name)
self.logger = logging.getLogger(__name__) self.logger = logging.getLogger(__name__)
self.raw_exif = None self.raw_exif = None
@ -95,8 +95,8 @@ class Media(UnicodeMixin):
self.logger.debug('siglican: Generating thumbnail for %r', self) self.logger.debug('siglican: Generating thumbnail for %r', self)
try: try:
generator(self.src_path, self.thumb_path, generator(self.src_path, self.thumb_path,
self.settings['SIGAL_THUMB_SIZE'], self.settings['SIGLICAN_THUMB_SIZE'],
fit=self.settings['SIGAL_THUMB_FIT']) fit=self.settings['SIGLICAN_THUMB_FIT'])
except Exception as e: except Exception as e:
self.logger.error('siglican: Failed to generate thumbnail: %s', e) self.logger.error('siglican: Failed to generate thumbnail: %s', e)
return return
@ -139,7 +139,7 @@ class Video(Media):
base = os.path.splitext(filename)[0] base = os.path.splitext(filename)[0]
self.src_filename = filename self.src_filename = filename
self.filename = self.url = base + '.webm' self.filename = self.url = base + '.webm'
self.dst_path = os.path.join(settings['SIGAL_DESTINATION'], path, base + '.webm') self.dst_path = os.path.join(settings['SIGLICAN_DESTINATION'], path, base + '.webm')
# minimally modified from Sigal's gallery.Album class # minimally modified from Sigal's gallery.Album class
@ -157,25 +157,25 @@ class Album(object):
# set up source and destination paths # set up source and destination paths
if path == '.': if path == '.':
self.src_path = settings['SIGAL_SOURCE'] self.src_path = settings['SIGLICAN_SOURCE']
self.dst_path = settings['SIGAL_DESTINATION'] self.dst_path = settings['SIGLICAN_DESTINATION']
else: else:
self.src_path = os.path.join(settings['SIGAL_SOURCE'], path) self.src_path = os.path.join(settings['SIGLICAN_SOURCE'], path)
self.dst_path = os.path.join(settings['SIGAL_DESTINATION'], path) self.dst_path = os.path.join(settings['SIGLICAN_DESTINATION'], path)
self.logger = logging.getLogger(__name__) self.logger = logging.getLogger(__name__)
self._get_metadata() # this reads the index.md file self._get_metadata() # this reads the index.md file
# optionally add index.html to the URLs # optionally add index.html to the URLs
# ** don't understand purpose of this; default is False # ** don't understand purpose of this; default is False
self.url_ext = self.output_file if settings['SIGAL_INDEX_IN_URL'] else '' self.url_ext = self.output_file if settings['SIGLICAN_INDEX_IN_URL'] else ''
# creates appropriate subdirectory for the album # creates appropriate subdirectory for the album
self.index_url = url_from_path(os.path.relpath( self.index_url = url_from_path(os.path.relpath(
settings['SIGAL_DESTINATION'], self.dst_path)) + '/' + self.url_ext settings['SIGLICAN_DESTINATION'], self.dst_path)) + '/' + self.url_ext
# sort sub-albums # sort sub-albums
dirnames.sort(key=strxfrm, reverse=settings['SIGAL_ALBUMS_SORT_REVERSE']) dirnames.sort(key=strxfrm, reverse=settings['SIGLICAN_ALBUMS_SORT_REVERSE'])
self.subdirs = dirnames self.subdirs = dirnames
#: List of all medias in the album (:class:`~sigal.gallery.Image` and #: List of all medias in the album (:class:`~sigal.gallery.Image` and
@ -198,13 +198,13 @@ class Album(object):
# sort images # sort images
if medias: if medias:
medias_sort_attr = settings['SIGAL_MEDIAS_SORT_ATTR'] medias_sort_attr = settings['SIGLICAN_MEDIAS_SORT_ATTR']
if medias_sort_attr == 'date': if medias_sort_attr == 'date':
key = lambda s: s.date or datetime.now() key = lambda s: s.date or datetime.now()
else: else:
key = lambda s: strxfrm(getattr(s, medias_sort_attr)) key = lambda s: strxfrm(getattr(s, medias_sort_attr))
medias.sort(key=key, reverse=settings['SIGAL_MEDIAS_SORT_REVERSE']) medias.sort(key=key, reverse=settings['SIGLICAN_MEDIAS_SORT_REVERSE'])
#signals.album_initialized.send(self) #signals.album_initialized.send(self)
@ -253,10 +253,10 @@ class Album(object):
if self.medias: if self.medias:
check_or_create_dir(os.path.join(self.dst_path, check_or_create_dir(os.path.join(self.dst_path,
self.settings['SIGAL_THUMB_DIR'])) self.settings['SIGLICAN_THUMB_DIR']))
#if self.medias and self.settings['SIGAL_KEEP_ORIG']: #if self.medias and self.settings['SIGLICAN_KEEP_ORIG']:
# self.orig_path = os.path.join(self.dst_path, self.settings['SIGAL_ORIG_DIR']) # self.orig_path = os.path.join(self.dst_path, self.settings['SIGLICAN_ORIG_DIR'])
# check_or_create_dir(self.orig_path) # check_or_create_dir(self.orig_path)
@property @property
@ -368,13 +368,13 @@ class Album(object):
archive with all original images of the corresponding directory. archive with all original images of the corresponding directory.
""" """
zip_gallery = self.settings['SIGAL_ZIP_GALLERY'] zip_gallery = self.settings['SIGLICAN_ZIP_GALLERY']
if zip_gallery and len(self) > 0: if zip_gallery and len(self) > 0:
archive_path = os.path.join(self.dst_path, zip_gallery) archive_path = os.path.join(self.dst_path, zip_gallery)
archive = zipfile.ZipFile(archive_path, 'w') archive = zipfile.ZipFile(archive_path, 'w')
if self.settings['SIGAL_ZIP_MEDIA_FORMAT'] == 'orig': if self.settings['SIGLICAN_ZIP_MEDIA_FORMAT'] == 'orig':
for p in self: for p in self:
archive.write(p.src_path, os.path.split(p.src_path)[1]) archive.write(p.src_path, os.path.split(p.src_path)[1])
else: else:
@ -408,8 +408,8 @@ def get_thumb(settings, filename):
if ext.lower() in Video.extensions: if ext.lower() in Video.extensions:
ext = '.jpg' ext = '.jpg'
return os.path.join(path, settings['SIGAL_THUMB_DIR'], settings['SIGAL_THUMB_PREFIX'] + return os.path.join(path, settings['SIGLICAN_THUMB_DIR'], settings['SIGLICAN_THUMB_PREFIX'] +
name + settings['SIGAL_THUMB_SUFFIX'] + ext) name + settings['SIGLICAN_THUMB_SUFFIX'] + ext)
def get_exif_tags(source): def get_exif_tags(source):
"""Read EXIF tags from file @source and return a tuple of two dictionaries, """Read EXIF tags from file @source and return a tuple of two dictionaries,

View file

@ -20,8 +20,8 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE. # IN THE SOFTWARE.
## ** TODO: use pelican's compatibility features in utils.py (which uses ## ** TODO: consider switching to use pelican's compat features in utils.py
## Django calls) ## (which uses Django calls)
import locale import locale
import sys import sys

View file

@ -68,13 +68,13 @@ def generate_image(source, outname, settings, options=None):
img = PILImage.open(source) img = PILImage.open(source)
original_format = img.format original_format = img.format
if settings['SIGAL_COPY_EXIF_DATA'] and settings['SIGAL_AUTOROTATE_IMAGES']: if settings['SIGLICAN_COPY_EXIF_DATA'] and settings['SIGLICAN_AUTOROTATE_IMAGES']:
logger.warning("The 'autorotate_images' and 'copy_exif_data' settings " logger.warning("The 'autorotate_images' and 'copy_exif_data' settings "
"are not compatible because Sigal can't save the " "are not compatible because Sigal can't save the "
"modified Orientation tag.") "modified Orientation tag.")
# Preserve EXIF data # Preserve EXIF data
if settings['SIGAL_COPY_EXIF_DATA'] and _has_exif_tags(img): if settings['SIGLICAN_COPY_EXIF_DATA'] and _has_exif_tags(img):
if options is not None: if options is not None:
options = deepcopy(options) options = deepcopy(options)
else: else:
@ -82,23 +82,23 @@ def generate_image(source, outname, settings, options=None):
options['exif'] = img.info['exif'] options['exif'] = img.info['exif']
# Rotate the img, and catch IOError when PIL fails to read EXIF # Rotate the img, and catch IOError when PIL fails to read EXIF
if settings['SIGAL_AUTOROTATE_IMAGES']: if settings['SIGLICAN_AUTOROTATE_IMAGES']:
try: try:
img = Transpose().process(img) img = Transpose().process(img)
except (IOError, IndexError): except (IOError, IndexError):
pass pass
# Resize the image # Resize the image
if settings['SIGAL_IMG_PROCESSOR']: if settings['SIGLICAN_IMG_PROCESSOR']:
try: try:
logger.debug('Processor: %s', settings['SIGAL_IMG_PROCESSOR']) logger.debug('Processor: %s', settings['SIGLICAN_IMG_PROCESSOR'])
processor_cls = getattr(pilkit.processors, processor_cls = getattr(pilkit.processors,
settings['SIGAL_IMG_PROCESSOR']) settings['SIGLICAN_IMG_PROCESSOR'])
except AttributeError: except AttributeError:
logger.error('Wrong processor name: %s', settings['SIGAL_IMG_PROCESSOR']) logger.error('Wrong processor name: %s', settings['SIGLICAN_IMG_PROCESSOR'])
sys.exit() sys.exit()
processor = processor_cls(*settings['SIGAL_IMG_SIZE'], upscale=False) processor = processor_cls(*settings['SIGLICAN_IMG_SIZE'], upscale=False)
img = processor.process(img) img = processor.process(img)
# TODO ** delete (maintained from Sigal for reference) # TODO ** delete (maintained from Sigal for reference)
@ -138,7 +138,7 @@ def process_image(filepath, outpath, settings):
ext = os.path.splitext(filename)[1] ext = os.path.splitext(filename)[1]
if ext in ('.jpg', '.jpeg', '.JPG', '.JPEG'): if ext in ('.jpg', '.jpeg', '.JPG', '.JPEG'):
options = settings['SIGAL_JPG_OPTIONS'] options = settings['SIGLICAN_JPG_OPTIONS']
elif ext == '.png': elif ext == '.png':
options = {'optimize': True} options = {'optimize': True}
else: else:
@ -150,10 +150,10 @@ def process_image(filepath, outpath, settings):
logger.error('Failed to process image: %s', e) logger.error('Failed to process image: %s', e)
return return
if settings['SIGAL_MAKE_THUMBS']: if settings['SIGLICAN_MAKE_THUMBS']:
thumb_name = os.path.join(outpath, get_thumb(settings, filename)) thumb_name = os.path.join(outpath, get_thumb(settings, filename))
generate_thumbnail(outname, thumb_name, settings['SIGAL_THUMB_SIZE'], generate_thumbnail(outname, thumb_name, settings['SIGLICAN_THUMB_SIZE'],
fit=settings['SIGAL_THUMB_FIT'], options=options) fit=settings['SIGLICAN_THUMB_FIT'], options=options)
def _get_exif_data(filename): def _get_exif_data(filename):
@ -197,6 +197,6 @@ def get_thumb(settings, filename):
if ext.lower() in Video.extensions: if ext.lower() in Video.extensions:
ext = '.jpg' ext = '.jpg'
return os.path.join(path, settings['SIGAL_THUMB_DIR'], settings['SIGAL_THUMB_PREFIX'] + return os.path.join(path, settings['SIGLICAN_THUMB_DIR'], settings['SIGLICAN_THUMB_PREFIX'] +
name + settings['SIGAL_THUMB_SUFFIX'] + ext) name + settings['SIGLICAN_THUMB_SUFFIX'] + ext)

View file

@ -37,43 +37,41 @@ logger = logging.getLogger(__name__)
# Default config from Sigal's settings module. These have been changed to # Default config from Sigal's settings module. These have been changed to
# upper case because Pelican does not recognize lower case configuration names. # upper case because Pelican does not recognize lower case configuration names.
_DEFAULT_SIGAL_SETTINGS = { _DEFAULT_SIGLICAN_SETTINGS = {
'SIGAL_ALBUMS_SORT_REVERSE': False, 'SIGLICAN_ALBUMS_SORT_REVERSE': False,
'SIGAL_AUTOROTATE_IMAGES': True, 'SIGLICAN_AUTOROTATE_IMAGES': True,
'SIGAL_COLORBOX_COLUMN_SIZE': 4, 'SIGLICAN_COLORBOX_COLUMN_SIZE': 4,
'SIGAL_COPY_EXIF_DATA': False, 'SIGLICAN_COPY_EXIF_DATA': False,
'SIGAL_DESTINATION': 'gallery', 'SIGLICAN_DESTINATION': 'gallery',
'SIGAL_FILES_TO_COPY': (), 'SIGLICAN_FILES_TO_COPY': (),
# 'GOOGLE_ANALYTICS': '', 'SIGLICAN_IGNORE_DIRECTORIES': ['.'],
'SIGAL_IGNORE_DIRECTORIES': ['.'], # using a pelican theme template as base 'SIGLICAN_IGNORE_FILES': [],
'SIGAL_IGNORE_FILES': [], 'SIGLICAN_IMG_PROCESSOR': 'ResizeToFit',
'SIGAL_IMG_PROCESSOR': 'ResizeToFit', 'SIGLICAN_IMG_SIZE': (640, 480),
'SIGAL_IMG_SIZE': (640, 480), 'SIGLICAN_INDEX_IN_URL': False,
'SIGAL_INDEX_IN_URL': False, 'SIGLICAN_JPG_OPTIONS': {'quality': 85, 'optimize': True, 'progressive': True},
'SIGAL_JPG_OPTIONS': {'quality': 85, 'optimize': True, 'progressive': True}, 'SIGLICAN_LINKS': '',
# 'SIGAL_KEEP_ORIG': False, 'SIGLICAN_LOCALE': '',
'SIGAL_LINKS': '', 'SIGLICAN_MEDIAS_SORT_ATTR': 'filename',
'SIGAL_LOCALE': '', 'SIGLICAN_MEDIAS_SORT_REVERSE': False,
'SIGAL_MEDIAS_SORT_ATTR': 'filename', 'SIGLICAN_MAKE_THUMBS': True,
'SIGAL_MEDIAS_SORT_REVERSE': False, 'SIGLICAN_ORIG_DIR': 'original',
'SIGAL_MAKE_THUMBS': True, 'SIGLICAN_ORIG_LINK': False,
'SIGAL_ORIG_DIR': 'original',
'SIGAL_ORIG_LINK': False,
# 'PLUGINS': [], # 'PLUGINS': [],
# 'PLUGIN_PATHS': [], # 'PLUGIN_PATHS': [],
'SIGAL_SOURCE': 'siglican', 'SIGLICAN_SOURCE': 'siglican',
'SIGAL_THEME': 'colorbox', 'SIGLICAN_THEME': 'colorbox',
'SIGAL_THUMB_DIR': 'thumbs', 'SIGLICAN_THUMB_DIR': 'thumbs',
'SIGAL_THUMB_FIT': True, 'SIGLICAN_THUMB_FIT': True,
'SIGAL_THUMB_PREFIX': '', 'SIGLICAN_THUMB_PREFIX': '',
'SIGAL_THUMB_SIZE': (200, 150), 'SIGLICAN_THUMB_SIZE': (200, 150),
'SIGAL_THUMB_SUFFIX': '', 'SIGLICAN_THUMB_SUFFIX': '',
'SIGAL_VIDEO_SIZE': (480, 360), 'SIGLICAN_VIDEO_SIZE': (480, 360),
'SIGAL_WEBM_OPTIONS': ['-crf', '10', '-b:v', '1.6M', 'SIGLICAN_WEBM_OPTIONS': ['-crf', '10', '-b:v', '1.6M',
'-qmin', '4', '-qmax', '63'], '-qmin', '4', '-qmax', '63'],
'SIGAL_WRITE_HTML': True, 'SIGLICAN_WRITE_HTML': True,
'SIGAL_ZIP_GALLERY': False, 'SIGLICAN_ZIP_GALLERY': False,
'SIGAL_ZIP_MEDIA_FORMAT': 'resized', 'SIGLICAN_ZIP_MEDIA_FORMAT': 'resized',
} }
# Generator class used to generate plugin context and write. # Generator class used to generate plugin context and write.
@ -93,8 +91,8 @@ class SigalGalleryGenerator(Generator):
# this needs to be first to establish pelican settings: # this needs to be first to establish pelican settings:
super(SigalGalleryGenerator, self).__init__(*args, **kwargs) super(SigalGalleryGenerator, self).__init__(*args, **kwargs)
# add default sigal settings to generator settings: # add default sigal settings to generator settings:
for k in _DEFAULT_SIGAL_SETTINGS.keys()[:]: for k in _DEFAULT_SIGLICAN_SETTINGS.keys()[:]:
self.settings[k] = self.settings.get(k, _DEFAULT_SIGAL_SETTINGS[k]) self.settings[k] = self.settings.get(k, _DEFAULT_SIGLICAN_SETTINGS[k])
logger.debug("sigal.pelican: setting %s: %s",k,self.settings[k]) logger.debug("sigal.pelican: setting %s: %s",k,self.settings[k])
self._clean_settings() self._clean_settings()
# this is where we could create a signal if we wanted to, e.g.: # this is where we could create a signal if we wanted to, e.g.:
@ -104,38 +102,38 @@ class SigalGalleryGenerator(Generator):
"""Checks existence of directories and normalizes image size settings.""" """Checks existence of directories and normalizes image size settings."""
# create absolute paths to source, theme and destination directories: # create absolute paths to source, theme and destination directories:
init_source = self.settings['SIGAL_SOURCE'] init_source = self.settings['SIGLICAN_SOURCE']
self.settings['SIGAL_SOURCE'] = os.path.normpath(self.settings['PATH'] + self.settings['SIGLICAN_SOURCE'] = os.path.normpath(self.settings['PATH'] +
"/../" + self.settings['SIGAL_SOURCE'] + '/images') "/../" + self.settings['SIGLICAN_SOURCE'] + '/images')
self.settings['SIGAL_THEME'] = os.path.normpath(self.settings['PATH'] + self.settings['SIGLICAN_THEME'] = os.path.normpath(self.settings['PATH'] +
"/../" + init_source + "/" + self.settings['SIGAL_THEME']) "/../" + init_source + "/" + self.settings['SIGLICAN_THEME'])
self.settings['SIGAL_DESTINATION'] = os.path.normpath( self.settings['SIGLICAN_DESTINATION'] = os.path.normpath(
self.settings['OUTPUT_PATH'] + "/" + self.settings['SIGAL_DESTINATION']) self.settings['OUTPUT_PATH'] + "/" + self.settings['SIGLICAN_DESTINATION'])
enc = locale.getpreferredencoding() if PY2 else None enc = locale.getpreferredencoding() if PY2 else None
# test for existence of source directories # test for existence of source directories
pathkeys = ['SIGAL_SOURCE', 'SIGAL_THEME'] pathkeys = ['SIGLICAN_SOURCE', 'SIGLICAN_THEME']
for k in pathkeys: for k in pathkeys:
if os.path.isdir(self.settings[k]): if os.path.isdir(self.settings[k]):
# convert to unicode for os.walk dirname/filename # convert to unicode for os.walk dirname/filename
if PY2 and isinstance(self.settings[k], str): if PY2 and isinstance(self.settings[k], str):
self.settings[k] = self.settings[k].decode(enc) self.settings[k] = self.settings[k].decode(enc)
logger.debug("siglican: %s = %s",k,self.settings[k]) logger.info("%s = %s",k,self.settings[k])
else: else:
logger.error("siglican: missing source directory %s: %s", logger.error("siglican: missing source directory %s: %s",
k,self.settings[k]) k,self.settings[k])
sys.exit(1) sys.exit(1)
# normalize sizes as e landscape # normalize sizes as e landscape
for key in ('SIGAL_IMG_SIZE', 'SIGAL_THUMB_SIZE', 'SIGAL_VIDEO_SIZE'): for key in ('SIGLICAN_IMG_SIZE', 'SIGLICAN_THUMB_SIZE', 'SIGLICAN_VIDEO_SIZE'):
w, h = self.settings[key] w, h = self.settings[key]
if h > w: if h > w:
self.settings[key] = (h, w) self.settings[key] = (h, w)
logger.warning("siglican: The %s setting should be specified " logger.warning("siglican: The %s setting should be specified "
"with the largest value first.", key) "with the largest value first.", key)
if not self.settings['SIGAL_IMG_PROCESSOR']: if not self.settings['SIGLICAN_IMG_PROCESSOR']:
logger.info('No Processor, images will not be resized') logger.info('No Processor, images will not be resized')
# based on Sigal's Gallery.__init__() method: # based on Sigal's Gallery.__init__() method:
@ -143,14 +141,14 @@ class SigalGalleryGenerator(Generator):
""""Update the global Pelican context that's shared between generators.""" """"Update the global Pelican context that's shared between generators."""
logger.debug("siglican: in generate_context()") logger.debug("siglican: in generate_context()")
locale.setlocale(locale.LC_ALL, self.settings['SIGAL_LOCALE']) locale.setlocale(locale.LC_ALL, self.settings['SIGLICAN_LOCALE'])
self.stats = {'image': 0, 'image_skipped': 0, self.stats = {'image': 0, 'image_skipped': 0,
'video': 0, 'video_skipped': 0} 'video': 0, 'video_skipped': 0}
# build the list of directories with images # build the list of directories with images
# ** TODO: add error checking, consider use of get(), etc. # ** TODO: add error checking, consider use of get(), etc.
src_path = self.settings['SIGAL_SOURCE'] src_path = self.settings['SIGLICAN_SOURCE']
ignore_dirs = self.settings['SIGAL_IGNORE_DIRECTORIES'] ignore_dirs = self.settings['SIGLICAN_IGNORE_DIRECTORIES']
ignore_files = self.settings['SIGAL_IGNORE_FILES'] ignore_files = self.settings['SIGLICAN_IGNORE_FILES']
for path, dirs, files in os.walk(src_path, followlinks=True, for path, dirs, files in os.walk(src_path, followlinks=True,
topdown=False): topdown=False):
relpath = os.path.relpath(path, src_path) relpath = os.path.relpath(path, src_path)
@ -191,7 +189,7 @@ class SigalGalleryGenerator(Generator):
self.context['ALBUMS'] = self.albums self.context['ALBUMS'] = self.albums
# update the jinja context with the default sigal settings: # update the jinja context with the default sigal settings:
for k,v in _DEFAULT_SIGAL_SETTINGS.iteritems(): for k,v in _DEFAULT_SIGLICAN_SETTINGS.iteritems():
if not k in self.context: if not k in self.context:
self.context[k] = v self.context[k] = v
@ -209,8 +207,8 @@ class SigalGalleryGenerator(Generator):
# page.gallery=gallery # page.gallery=gallery
# create destination directory # create destination directory
if not os.path.isdir(self.settings['SIGAL_DESTINATION']): if not os.path.isdir(self.settings['SIGLICAN_DESTINATION']):
os.makedirs(self.settings['SIGAL_DESTINATION']) os.makedirs(self.settings['SIGLICAN_DESTINATION'])
# TODO ** add lots of error/exception catching # TODO ** add lots of error/exception catching
# TODO ** re-integrate multiprocessing logic from Sigal # TODO ** re-integrate multiprocessing logic from Sigal
@ -238,10 +236,10 @@ class SigalGalleryGenerator(Generator):
media.dst_path),self.settings) media.dst_path),self.settings)
# generate the index.html files for the albums # generate the index.html files for the albums
if self.settings['SIGAL_WRITE_HTML']: # defaults to True if self.settings['SIGLICAN_WRITE_HTML']: # defaults to True
# locate the theme; check for a custom theme in ./sigal/themes, if not # locate the theme; check for a custom theme in ./sigal/themes, if not
# found, look for a default in siglican/themes # found, look for a default in siglican/themes
self.theme = self.settings['SIGAL_THEME'] self.theme = self.settings['SIGLICAN_THEME']
default_themes = os.path.normpath(os.path.join( default_themes = os.path.normpath(os.path.join(
os.path.abspath(os.path.dirname(__file__)), 'themes')) os.path.abspath(os.path.dirname(__file__)), 'themes'))
#logger.debug("siglican: custom theme: %s", self.theme) #logger.debug("siglican: custom theme: %s", self.theme)

View file

@ -10,15 +10,15 @@
{% block head %} {% block head %}
{{ super() }} {{ super() }}
<link rel="stylesheet" href="{{ SIGAL_THEME_URL }}/css/style.min.css"> <link rel="stylesheet" href="{{ SIGLICAN_THEME_URL }}/css/style.min.css">
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div id="main" role="main" class="twelve columns offset-by-four"> <div id="main" role="main" class="twelve columns offset-by-four">
<header> <header>
{% if SIGAL_ALBUM.breadcrumb %} {% if SIGLICAN_ALBUM.breadcrumb %}
<h2> <h2>
{% for url, title in SIGAL_ALBUM.breadcrumb %} {% for url, title in SIGLICAN_ALBUM.breadcrumb %}
<a href="{{ url }}">{{ title }}</a>{% if not loop.last %} » {% endif %} <a href="{{ url }}">{{ title }}</a>{% if not loop.last %} » {% endif %}
{% endfor -%} {% endfor -%}
</h2> </h2>
@ -28,12 +28,12 @@
{% set numbers = ["zero", "one", "two", "three", "four", "five", "six", {% set numbers = ["zero", "one", "two", "three", "four", "five", "six",
"seven", "eight", "nine", "ten", "eleven", "twelve"] %} "seven", "eight", "nine", "ten", "eleven", "twelve"] %}
{% set column_size = SIGAL_COLORBOX_COLUMN_SIZE %} {% set column_size = SIGLICAN_COLORBOX_COLUMN_SIZE %}
{% set nb_columns = (12 / column_size)|int %} {% set nb_columns = (12 / column_size)|int %}
{% set column_size_t = numbers[column_size] %} {% set column_size_t = numbers[column_size] %}
{% if SIGAL_ALBUM.albums %} {% if SIGLICAN_ALBUM.albums %}
{% for alb in SIGAL_ALBUM.albums %} {% for alb in SIGLICAN_ALBUM.albums %}
{% if loop.index % nb_columns == 1 %} {% if loop.index % nb_columns == 1 %}
<div id="albums" class="row"> <div id="albums" class="row">
{% endif%} {% endif%}
@ -51,7 +51,7 @@
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% if SIGAL_ALBUM.medias %} {% if SIGLICAN_ALBUM.medias %}
{% macro img_description(media) -%} {% macro img_description(media) -%}
{% if media.big %} data-big="{{ media.big }}"{% endif %} {% if media.big %} data-big="{{ media.big }}"{% endif %}
{% if media.exif %} {% if media.exif %}
@ -61,7 +61,7 @@
{% endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
<div id="gallery" class="row"> <div id="gallery" class="row">
{% for media in SIGAL_ALBUM.medias %} {% for media in SIGLICAN_ALBUM.medias %}
{% if media.type == "image" %} {% if media.type == "image" %}
<div class="{{ column_size_t }} columns thumbnail <div class="{{ column_size_t }} columns thumbnail
{% if loop.index % nb_columns == 1 %}alpha{% endif%} {% if loop.index % nb_columns == 1 %}alpha{% endif%}
@ -94,25 +94,25 @@
</div> </div>
{% endif %} {% endif %}
{% if SIGAL_ALBUM.zip %} {% if SIGLICAN_ALBUM.zip %}
<div id="additionnal-infos" class="row"> <div id="additionnal-infos" class="row">
<p><a href="{{ album.zip }}" <p><a href="{{ album.zip }}"
title="Download a zip archive with all images">Download ZIP</a></p> title="Download a zip archive with all images">Download ZIP</a></p>
</div> </div>
{% endif %} {% endif %}
{% if SIGAL_ALBUM.description %} {% if SIGLICAN_ALBUM.description %}
<div id="description" class="row"> <div id="description" class="row">
{{ SIGAL_ALBUM.description }} {{ SIGLICAN_ALBUM.description }}
</div> </div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
{% if SIGAL_ALBUM.medias %} {% if SIGLICAN_ALBUM.medias %}
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>!window.jQuery && document.write(unescape('%3Cscript src="{{ SIGAL_THEME_URL }}/js/jquery-1.10.2.min.js"%3E%3C/script%3E'))</script> <script>!window.jQuery && document.write(unescape('%3Cscript src="{{ SIGLICAN_THEME_URL }}/js/jquery-1.10.2.min.js"%3E%3C/script%3E'))</script>
<script src="{{ SIGAL_THEME_URL }}/js/jquery.colorbox.min.js"></script> <script src="{{ SIGLICAN_THEME_URL }}/js/jquery.colorbox.min.js"></script>
<script> <script>
$(".gallery").colorbox({ $(".gallery").colorbox({

View file

@ -47,7 +47,7 @@ class Writer(object):
self.settings = settings self.settings = settings
self.theme = theme self.theme = theme
self.index_title = index_title self.index_title = index_title
self.output_dir = settings['SIGAL_DESTINATION'] self.output_dir = settings['SIGLICAN_DESTINATION']
self.logger = logging.getLogger(__name__) self.logger = logging.getLogger(__name__)
self.logger.debug("siglican theme: %s", theme) self.logger.debug("siglican theme: %s", theme)
@ -81,11 +81,11 @@ class Writer(object):
"""Generate the context dict for the given path.""" """Generate the context dict for the given path."""
albumdict = { albumdict = {
'SIGAL_ALBUM': album, 'SIGLICAN_ALBUM': album,
'SIGAL_INDEX_TITLE': self.index_title, 'SIGLICAN_INDEX_TITLE': self.index_title,
'SIGAL_LINK': sigal_link, 'SIGLICAN_LINK': sigal_link,
'SIGAL_THEME_NAME': os.path.basename(self.theme), 'SIGLICAN_THEME_NAME': os.path.basename(self.theme),
'SIGAL_THEME_URL': url_from_path( 'SIGLICAN_THEME_URL': url_from_path(
os.path.relpath(self.theme_path, os.path.relpath(self.theme_path,
album.dst_path)) album.dst_path))
} }