Skip to content
Permalink
Browse files

Merge branch 'master' into generalization-of-taxonomies

  • Loading branch information
felixfontein committed Dec 1, 2016
2 parents c55b913 + 85b22e8 commit 1244460b3dd792522e52e45cb412d6bf262b88a5
Showing with 16 additions and 8 deletions.
  1. +1 −0 AUTHORS.txt
  2. +1 −0 CHANGES.txt
  3. +3 −1 docs/manual.txt
  4. +3 −1 nikola/conf.py.in
  5. +1 −0 nikola/nikola.py
  6. +7 −6 nikola/plugins/task/scale_images.py
@@ -74,6 +74,7 @@
* `Miguel Ángel García <https://github.com/magmax>`_
* `mrabbitt <https://github.com/mrabbitt>`_
* `Neil MartinsenBurrell <https://github.com/neilmb>`_
* `Niels Böhm <https://github.com/blubberdiblub>`_
* `Niko Wenselowski <https://github.com/okin>`_
* `Nikola Kotur <https://github.com/kotnik>`_
* `nlaurens <https://github.com/nlaurens>`_
@@ -23,6 +23,7 @@ Features
translated (Issue #2116)
* Pass ``post`` object and ``lang`` to post compilers (Issue #2531)
* Pass ``url_type`` into template's context.
* Make thumbnail naming configurable with ``IMAGE_THUMBNAIL_FORMAT``.
* There is a new plugin category ``TaxonomyPlugin`` which allows to
easily create new taxonomies. Some of the existing taxonomies
(authors, archives, indexes, page index, sections) have been
@@ -1641,8 +1641,10 @@ The ``conf.py`` options affecting images and gallery pages are these:

# Images will be scaled down according to IMAGE_THUMBNAIL_SIZE and MAX_IMAGE_SIZE
# options, but will have to be referenced manually to be visible on the site
# (the thumbnail has ``.thumbnail`` added before the file extension).
# (the thumbnail has ``.thumbnail`` added before the file extension by default,
# but a different naming template can be configured with IMAGE_THUMBNAIL_FORMAT).
IMAGE_THUMBNAIL_SIZE = 400
IMAGE_THUMBNAIL_FORMAT = '{name}.thumbnail{ext}'

If you add a reST file in ``galleries/gallery_name/index.txt`` its contents will be
converted to HTML and inserted above the images in the gallery page. The
@@ -636,10 +636,12 @@ GITHUB_COMMIT_SOURCE = True

# Images will be scaled down according to IMAGE_THUMBNAIL_SIZE and MAX_IMAGE_SIZE
# options, but will have to be referenced manually to be visible on the site
# (the thumbnail has ``.thumbnail`` added before the file extension).
# (the thumbnail has ``.thumbnail`` added before the file extension by default,
# but a different naming template can be configured with IMAGE_THUMBNAIL_FORMAT).

IMAGE_FOLDERS = {'images': 'images'}
# IMAGE_THUMBNAIL_SIZE = 400
# IMAGE_THUMBNAIL_FORMAT = '{name}.thumbnail{ext}'

# #############################################################################
# HTML fragments and diverse things that are used by the templates
@@ -502,6 +502,7 @@ def __init__(self, **config):
'INDEX_FILE': 'index.html',
'INDEX_TEASERS': False,
'IMAGE_THUMBNAIL_SIZE': 400,
'IMAGE_THUMBNAIL_FORMAT': '{name}.thumbnail{ext}',
'INDEXES_TITLE': "",
'INDEXES_PAGES': "",
'INDEXES_PAGES_MAIN': False,
@@ -45,22 +45,22 @@ def set_site(self, site):

def process_tree(self, src, dst):
"""Process all images in a src tree and put the (possibly) rescaled images in the dst folder."""
ignore = set(['.svn'])
thumb_fmt = self.kw['image_thumbnail_format']
base_len = len(src.split(os.sep))
for root, dirs, files in os.walk(src, followlinks=True):
root_parts = root.split(os.sep)
if set(root_parts) & ignore:
continue
dst_dir = os.path.join(dst, *root_parts[base_len:])
utils.makedirs(dst_dir)
for src_name in files:
if src_name in ('.DS_Store', 'Thumbs.db'):
continue
if (not src_name.lower().endswith(tuple(self.image_ext_list)) and not src_name.upper().endswith(tuple(self.image_ext_list))):
continue
dst_file = os.path.join(dst_dir, src_name)
src_file = os.path.join(root, src_name)
thumb_file = '.thumbnail'.join(os.path.splitext(dst_file))
thumb_name, thumb_ext = os.path.splitext(src_name)
thumb_file = os.path.join(dst_dir, thumb_fmt.format(
name=thumb_name,
ext=thumb_ext,
))
yield {
'name': dst_file,
'file_dep': [src_file],
@@ -78,6 +78,7 @@ def gen_tasks(self):
"""Copy static files into the output folder."""
self.kw = {
'image_thumbnail_size': self.site.config['IMAGE_THUMBNAIL_SIZE'],
'image_thumbnail_format': self.site.config['IMAGE_THUMBNAIL_FORMAT'],
'max_image_size': self.site.config['MAX_IMAGE_SIZE'],
'image_folders': self.site.config['IMAGE_FOLDERS'],
'output_folder': self.site.config['OUTPUT_FOLDER'],

0 comments on commit 1244460

Please sign in to comment.
You can’t perform that action at this time.