Skip to content
Permalink
Browse files
Add lang parameter to get_crumbs
Lead to random gallery breadcrumbs.

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Feb 11, 2016
1 parent bbbad16 commit 8fd1de0c9ed4c0b25c9b49ee55f3861b7568a51a
Showing with 3 additions and 5 deletions.
  1. +1 −3 nikola/plugins/task/galleries.py
  2. +2 −2 nikola/utils.py
@@ -204,8 +204,6 @@ def gen_tasks(self):
for task in self.remove_excluded_image(image, input_folder):
yield task

crumbs = utils.get_crumbs(gallery, index_folder=self)

for lang in self.kw['translations']:
# save navigation links as dependencies
self.kw['navigation_links|{0}'.format(lang)] = self.kw['global_context']['navigation_links'](lang)
@@ -259,7 +257,7 @@ def gen_tasks(self):

context["folders"] = natsort.natsorted(
folders, alg=natsort.ns.F | natsort.ns.IC)
context["crumbs"] = crumbs
context["crumbs"] = utils.get_crumbs(gallery, index_folder=self, lang=lang)
context["permalink"] = self.site.link("gallery", gallery, lang)
context["enable_comments"] = self.kw['comments_in_galleries']
context["thumbnail_size"] = self.kw["thumbnail_size"]
@@ -911,7 +911,7 @@ def unlessLink(action, target):
return task


def get_crumbs(path, is_file=False, index_folder=None):
def get_crumbs(path, is_file=False, index_folder=None, lang=None):
"""Create proper links for a crumb bar.
index_folder is used if you want to use title from index file
@@ -964,7 +964,7 @@ def get_crumbs(path, is_file=False, index_folder=None):
index_post = index_folder.parse_index(folder, '', '')
folder = folder.replace(crumb, '')
if index_post:
crumb = index_post.title() or crumb
crumb = index_post.title(lang) or crumb
_crumbs[i][1] = crumb
return list(reversed(_crumbs))

0 comments on commit 8fd1de0

Please sign in to comment.