Skip to content

Commit

Permalink
Merge branch 'master' into shortcodes2
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed May 8, 2017
2 parents af11c7d + ef84f85 commit ce8682d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions AUTHORS.txt
Expand Up @@ -45,6 +45,7 @@
* `Felix Schwarz <https://github.com/FelixSchwarz>`_
* `Florian Finkernagel <https://github.com/TyberiusPrime>`_
* `follower <https://github.com/follower>`_
* `George Leslie-Waksman <https://github.com/gwax>`_
* `Grzegorz Śliwiński <https://github.com/fizyk>`_
* `Guillermo O. Freschi <https://github.com/Tordek>`_
* `Hardening <https://github.com/hardening>`_
Expand Down
4 changes: 4 additions & 0 deletions CHANGES.txt
Expand Up @@ -20,12 +20,16 @@ Features
* Include KaTeX CSS automatically when needed (Issue #2715)
* Split out math code into new ``math_helper.tmpl`` template (Issue
#2715)
* Added ``jpegoptim_progressive`` filter to convert jpeg images to progressive
jpegs.

Bugfixes
--------

* More robust shortcodes, no need to escape URLs in reSt, work better
with LaTeX, etc.
* No longer creates empty subarchive pages, and no longer create broken
archive navigation links on day level (Issue #2734)
* Fixes post scanner plugin order (Issue #2720)
* Rename ``POSTS_SECTION_ARE_INDEXES`` to ``POSTS_SECTIONS_ARE_INDEXES``
* Make date ranges work in shortcode-based post lists (Issue #2690)
Expand Down
6 changes: 6 additions & 0 deletions nikola/filters.py
Expand Up @@ -178,6 +178,12 @@ def jpegoptim(infile, executable='jpegoptim'):
return runinplace("{} -p --strip-all -q %1".format(executable), infile)


@_ConfigurableFilter(executable='JPEGOPTIM_EXECUTABLE')
def jpegoptim_progressive(infile, executable='jpegoptim'):
"""Run jpegoptim on a file and convert to progressive."""
return runinplace("{} -p --strip-all --all-progressive -q %1".format(executable), infile)


@_ConfigurableFilter(executable='HTML_TIDY_EXECUTABLE')
def html_tidy_withconfig(infile, executable='tidy5'):
"""Run HTML Tidy with tidy5.conf as config file."""
Expand Down
9 changes: 6 additions & 3 deletions nikola/plugins/task/archive.py
Expand Up @@ -219,7 +219,7 @@ def provide_context_and_uptodate(self, classification, lang, node=None):
kw.update(context)
return context, kw

def postprocess_posts_per_classification(self, posts_per_section_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None):
def postprocess_posts_per_classification(self, posts_per_archive_per_language, flat_hierarchy_per_lang=None, hierarchy_lookup_per_lang=None):
"""Rearrange, modify or otherwise use the list of posts per classification and per language."""
# Build a lookup table for archive navigation, if we’ll need one.
if self.site.config['CREATE_ARCHIVE_NAVIGATION']:
Expand All @@ -229,14 +229,17 @@ def postprocess_posts_per_classification(self, posts_per_section_per_language, f
for lang, flat_hierarchy in flat_hierarchy_per_lang.items():
self.archive_navigation[lang] = defaultdict(list)
for node in flat_hierarchy:
if not self.site.config["SHOW_UNTRANSLATED_POSTS"]:
if not [x for x in posts_per_archive_per_language[lang][node.classification_name] if x.is_translation_available(lang)]:
continue
self.archive_navigation[lang][len(node.classification_path)].append(node.classification_name)

# We need to sort it. Natsort means it’s year 10000 compatible!
for k, v in self.archive_navigation[lang].items():
self.archive_navigation[lang][k] = natsort.natsorted(v, alg=natsort.ns.F | natsort.ns.IC)

return super(Archive, self).postprocess_posts_per_classification(posts_per_section_per_language, flat_hierarchy_per_lang, hierarchy_lookup_per_lang)
return super(Archive, self).postprocess_posts_per_classification(posts_per_archive_per_language, flat_hierarchy_per_lang, hierarchy_lookup_per_lang)

def should_generate_classification_page(self, classification, post_list, lang):
"""Only generates list of posts for classification if this function returns True."""
return len(classification.split('/')) < 3 or len(post_list) > 0
return classification == '' or len(post_list) > 0

0 comments on commit ce8682d

Please sign in to comment.