Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
merge master
  • Loading branch information
ralsina committed Jan 4, 2016
2 parents d31e8e6 + 8e92f13 commit 21dfc0f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -15,6 +15,7 @@ Bugfixes
--------

* Preserve EXIF data when resizing images (Issue #2204)
* Decide is_mathjax based on current language tags (Issue #2205)

New in v7.7.4
=============
Expand Down
4 changes: 3 additions & 1 deletion nikola/nikola.py
Expand Up @@ -1757,7 +1757,9 @@ def scan_posts(self, really=False, ignore_quit=False, quiet=False):
# Sort everything.

for thing in self.timeline, self.posts, self.all_posts, self.pages:
thing.sort(key=lambda p: (p.date, p.source_path))
thing.sort(key=lambda p:
(int(p.meta('priority')) if p.meta('priority') else 0,
p.date, p.source_path))
thing.reverse()
self._sort_category_hierarchy()

Expand Down
15 changes: 11 additions & 4 deletions nikola/post.py
Expand Up @@ -109,7 +109,6 @@ def __init__(
self.base_url = self.config['BASE_URL']
self.is_draft = False
self.is_private = False
self.is_mathjax = False
self.strip_indexes = self.config['STRIP_INDEXES']
self.index_file = self.config['INDEX_FILE']
self.pretty_urls = self.config['PRETTY_URLS']
Expand Down Expand Up @@ -223,9 +222,6 @@ def __init__(
self.use_in_feeds = use_in_feeds and not is_draft and not is_private \
and not self.publish_later

# If mathjax is a tag, or it's a ipynb post, then enable mathjax rendering support
self.is_mathjax = ('mathjax' in self.tags) or (self.compiler.name == 'ipynb')

# Register potential extra dependencies
self.compiler.register_extra_dependencies(self)

Expand Down Expand Up @@ -258,6 +254,17 @@ def _has_pretty_url(self, lang):
else:
return False

@property
def is_mathjax(self):
"""True if this post has the mathjax tag in the current language or is a python notebook."""
if self.compiler.name == 'ipynb':
return True
lang = nikola.utils.LocaleBorg().current_lang
if self.is_translation_available(lang):
return 'mathjax' in self.tags_for_language(lang)
# If it has math in ANY other language, enable it. Better inefficient than broken.
return 'mathjax' in self.alltags

@property
def alltags(self):
"""Return ALL the tags for this post."""
Expand Down

0 comments on commit 21dfc0f

Please sign in to comment.