Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
merged master
  • Loading branch information
ralsina committed Jan 27, 2016
2 parents 52e6c61 + f915421 commit 304b9e5
Show file tree
Hide file tree
Showing 32 changed files with 120 additions and 52 deletions.
9 changes: 8 additions & 1 deletion CHANGES.txt
Expand Up @@ -10,12 +10,19 @@ Features
if ``GITHUB_COMMIT_SOURCE`` is set to True (Issue #2186)
* Hugo-like shortcodes (Issue #1707)
* New Galician translation
* New PRESERVE_EXIF_DATA to copy EXIF when resizing images (Issue #2204)

Bugfixes
--------

* Preserve EXIF data when resizing images (Issue #2204)
* Don’t attempt to create redirects for URLs with query strings in
WordPress imports if the site is in a subdirectory (Issue #2224)
* Avoid some random file rebuilds (Issue #2220)
* Honor ``MATHJAX_CONFIG``
* Display tags and archives in a unified format, with the date on the
left, instead of a misplaced dash in tags (Issue #2212)
* Decide is_mathjax based on current language tags (Issue #2205)
* Don't duplicate images in flowr when resizing page (Issue #2202)

New in v7.7.4
=============
Expand Down
14 changes: 10 additions & 4 deletions docs/manual.txt
Expand Up @@ -2146,7 +2146,13 @@ Nikola is released under the `MIT license <https://getnikola.com/license.html>`_
components shipped along with Nikola, or required by it are released under
other licenses.

If you are not familiar with free software licensing: In general, you should be able to
do pretty much anything you want, unless you modify Nikola. If you modify it, and share
it with someone else, that someone else should get all your modifications under the same
license you got it.

If you are not familiar with free software licensing, here is a brief
explanation (this is NOT legal advice): In general, you can do pretty much
anything you want — including modifying Nikola, using and redistributing the
original version or the your modified version. However, if you redistribute
Nikola to someone else, either a modified version or the original version, the
full copyright notice and license text must be included in your distribution.
Nikola is provided “as is”, and the Nikola contributors are not liable for any
damage caused by the software. Read the `full license text
<https://getnikola.com/license.html>`_ for details.
1 change: 1 addition & 0 deletions nikola/data/shortcodes/jinja/raw.tmpl
@@ -0,0 +1 @@
{{ data }}
2 changes: 1 addition & 1 deletion nikola/data/themes/base-jinja/templates/author.tmpl
Expand Up @@ -35,7 +35,7 @@
{% if posts %}
<ul class="postlist">
{% for post in posts %}
<li><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time></li>
<li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time> <a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a></li>
{% endfor %}
</ul>
{% endif %}
Expand Down
4 changes: 4 additions & 0 deletions nikola/data/themes/base-jinja/templates/index_helper.tmpl
Expand Up @@ -28,9 +28,13 @@
</script>
{% else %}
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
{% if mathjax_config %}
{{ mathjax_config }}
{% else %}
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
{% endif %}
{% endif %}
{% endif %}
{% endmacro %}
2 changes: 1 addition & 1 deletion nikola/data/themes/base-jinja/templates/list_post.tmpl
Expand Up @@ -9,7 +9,7 @@
{% if posts %}
<ul class="postlist">
{% for post in posts %}
<li><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a> <time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time></li>
<li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time> <a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}</a></li>
{% endfor %}
</ul>
{% else %}
Expand Down
4 changes: 4 additions & 0 deletions nikola/data/themes/base-jinja/templates/post_helper.tmpl
Expand Up @@ -94,9 +94,13 @@
</script>
{% else %}
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
{% if mathjax_config %}
{{ mathjax_config }}
{% else %}
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
{% endif %}
{% endif %}
{% endif %}
{% endmacro %}
2 changes: 1 addition & 1 deletion nikola/data/themes/base-jinja/templates/tag.tmpl
Expand Up @@ -43,7 +43,7 @@
{% if posts %}
<ul class="postlist">
{% for post in posts %}
<li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time><a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}<a></li>
<li><time class="listdate" datetime="{{ post.formatted_date('webiso') }}" title="{{ post.formatted_date(date_format)|e }}">{{ post.formatted_date(date_format)|e }}</time> <a href="{{ post.permalink() }}" class="listtitle">{{ post.title()|e }}<a></li>
{% endfor %}
</ul>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/base/assets/css/theme.css
Expand Up @@ -120,7 +120,7 @@ body {
}
.metadata p:before,
.postpromonav .tags li:before,
.postlist .listdate:before {
.postlist .listdate:after {
content: " — ";
}
.postlist li {
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/base/templates/author.tmpl
Expand Up @@ -35,7 +35,7 @@
%if posts:
<ul class="postlist">
% for post in posts:
<li><a href="${post.permalink()}" class="listtitle">${post.title()|h}</a><time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time></li>
<li><time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time> <a href="${post.permalink()}" class="listtitle">${post.title()|h}</a></li>
% endfor
</ul>
%endif
Expand Down
4 changes: 4 additions & 0 deletions nikola/data/themes/base/templates/index_helper.tmpl
Expand Up @@ -28,9 +28,13 @@
</script>
%else:
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
% if mathjax_config:
${mathjax_config}
% else:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
% endif
%endif
%endif
</%def>
2 changes: 1 addition & 1 deletion nikola/data/themes/base/templates/list_post.tmpl
Expand Up @@ -9,7 +9,7 @@
%if posts:
<ul class="postlist">
% for post in posts:
<li><a href="${post.permalink()}" class="listtitle">${post.title()|h}</a> <time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time></li>
<li><time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time> <a href="${post.permalink()}" class="listtitle">${post.title()|h}</a></li>
% endfor
</ul>
%else:
Expand Down
4 changes: 4 additions & 0 deletions nikola/data/themes/base/templates/post_helper.tmpl
Expand Up @@ -94,9 +94,13 @@
</script>
%else:
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"> </script>
% if mathjax_config:
${mathjax_config}
% else:
<script type="text/x-mathjax-config">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$latex ','$'], ['\\(','\\)']]}});
</script>
% endif
%endif
%endif
</%def>
2 changes: 1 addition & 1 deletion nikola/data/themes/base/templates/tag.tmpl
Expand Up @@ -43,7 +43,7 @@
%if posts:
<ul class="postlist">
% for post in posts:
<li><time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time><a href="${post.permalink()}" class="listtitle">${post.title()|h}<a></li>
<li><time class="listdate" datetime="${post.formatted_date('webiso')}" title="${post.formatted_date(date_format)|h}">${post.formatted_date(date_format)|h}</time> <a href="${post.permalink()}" class="listtitle">${post.title()|h}<a></li>
% endfor
</ul>
%endif
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nikola/data/themes/bootstrap3-jinja/assets/css/theme.css
Expand Up @@ -118,7 +118,7 @@ article.post-micro {
}

.metadata p:before,
.postlist .listdate:before {
.postlist .listdate:after {
content: " — ";
}

Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/bootstrap3-jinja/assets/js/flowr.plugin.js
Expand Up @@ -180,7 +180,7 @@
}
} //utils

// If the resposive var is set to true then listen for resize method
// If the responsive var is set to true then listen for resize method
// and prevent resizing from happening twice if responsive is set again during append phase!
if (settings.responsive && !$this.data('__responsive')) {
$(window).resize(function() {
Expand Down Expand Up @@ -211,7 +211,7 @@
var currentItem = 0;

// Store all the data
var allData = $this.data('data') || [];
var allData = [];
for (i = 0; i < data.length; i++) {
allData.push(data[i]);
}
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/bootstrap3/assets/css/theme.css
Expand Up @@ -118,7 +118,7 @@ article.post-micro {
}

.metadata p:before,
.postlist .listdate:before {
.postlist .listdate:after {
content: " — ";
}

Expand Down
4 changes: 2 additions & 2 deletions nikola/data/themes/bootstrap3/assets/js/flowr.plugin.js
Expand Up @@ -180,7 +180,7 @@
}
} //utils

// If the resposive var is set to true then listen for resize method
// If the responsive var is set to true then listen for resize method
// and prevent resizing from happening twice if responsive is set again during append phase!
if (settings.responsive && !$this.data('__responsive')) {
$(window).resize(function() {
Expand Down Expand Up @@ -211,7 +211,7 @@
var currentItem = 0;

// Store all the data
var allData = $this.data('data') || [];
var allData = [];
for (i = 0; i < data.length; i++) {
allData.push(data[i]);
}
Expand Down
32 changes: 16 additions & 16 deletions nikola/filters.py
Expand Up @@ -142,54 +142,54 @@ def yui_compressor(infile):
raise Exception("yui-compressor is not installed.")
return False

return runinplace(r'{} --nomunge %1 -o %2'.format(yuicompressor), infile)
return runinplace('{} --nomunge %1 -o %2'.format(yuicompressor), infile)


def closure_compiler(infile):
"""Run closure-compiler on a file."""
return runinplace(r'closure-compiler --warning_level QUIET --js %1 --js_output_file %2', infile)
return runinplace('closure-compiler --warning_level QUIET --js %1 --js_output_file %2', infile)


def optipng(infile):
"""Run optipng on a file."""
return runinplace(r"optipng -preserve -o2 -quiet %1", infile)
return runinplace("optipng -preserve -o2 -quiet %1", infile)


def jpegoptim(infile):
"""Run jpegoptim on a file."""
return runinplace(r"jpegoptim -p --strip-all -q %1", infile)
return runinplace("jpegoptim -p --strip-all -q %1", infile)


def html_tidy_withconfig(infile):
def html_tidy_withconfig(infile, executable='tidy5'):
"""Run HTML Tidy with tidy5.conf as config file."""
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent -config tidy5.conf -modify %1")
return _html_tidy_runner(infile, "-quiet --show-info no --show-warnings no -utf8 -indent -config tidy5.conf -modify %1", executable=executable)


def html_tidy_nowrap(infile):
def html_tidy_nowrap(infile, executable='tidy5'):
"""Run HTML Tidy without line wrapping."""
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes no --sort-attributes alpha --wrap 0 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1")
return _html_tidy_runner(infile, "-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes no --sort-attributes alpha --wrap 0 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1", executable=executable)


def html_tidy_wrap(infile):
def html_tidy_wrap(infile, executable='tidy5'):
"""Run HTML Tidy with line wrapping."""
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes no --sort-attributes alpha --wrap 80 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1")
return _html_tidy_runner(infile, "-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes no --sort-attributes alpha --wrap 80 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1", executable=executable)


def html_tidy_wrap_attr(infile):
def html_tidy_wrap_attr(infile, executable='tidy5'):
"""Run HTML tidy with line wrapping and attribute indentation."""
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes yes --sort-attributes alpha --wrap 80 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1")
return _html_tidy_runner(infile, "-quiet --show-info no --show-warnings no -utf8 -indent --indent-attributes yes --sort-attributes alpha --wrap 80 --wrap-sections no --drop-empty-elements no --tidy-mark no -modify %1", executable=executable)


def html_tidy_mini(infile):
def html_tidy_mini(infile, executable='tidy5'):
"""Run HTML tidy with minimal settings."""
return _html_tidy_runner(infile, r"-quiet --show-info no --show-warnings no -utf8 --indent-attributes no --sort-attributes alpha --wrap 0 --wrap-sections no --tidy-mark no --drop-empty-elements no -modify %1")
return _html_tidy_runner(infile, "-quiet --show-info no --show-warnings no -utf8 --indent-attributes no --sort-attributes alpha --wrap 0 --wrap-sections no --tidy-mark no --drop-empty-elements no -modify %1", executable=executable)


def _html_tidy_runner(infile, options):
def _html_tidy_runner(infile, options, executable='tidy5'):
"""Run HTML Tidy."""
# Warnings (returncode 1) are not critical, and *everything* is a warning.
try:
status = runinplace(r"tidy5 " + options, infile)
status = runinplace(executable + " " + options, infile)
except subprocess.CalledProcessError as err:
status = 0 if err.returncode == 1 else err.returncode
return status
Expand Down
2 changes: 1 addition & 1 deletion nikola/nikola.py
Expand Up @@ -2201,7 +2201,7 @@ def generic_index_renderer(self, lang, posts, indexes_title, template_name, cont

def __repr__(self):
"""Representation of a Nikola site."""
return '<Nikola Site: {0!r}>'.format(self.config['BLOG_TITLE']())
return '<Nikola Site: {0!r}>'.format(self.config['BLOG_TITLE'](self.config['DEFAULT_LANG']))


def sanitized_locales(locale_fallback, locale_default, locales, translations):
Expand Down
8 changes: 5 additions & 3 deletions nikola/plugins/basic_import.py
Expand Up @@ -76,8 +76,11 @@ def get_channel_from_file(cls, filename):
return channel

@staticmethod
def configure_redirections(url_map):
def configure_redirections(url_map, base_dir=''):
"""Configure redirections from an url_map."""
index = base_dir + 'index.html'
if index.startswith('/'):
index = index[1:]
redirections = []
for k, v in url_map.items():
if not k[-1] == '/':
Expand All @@ -86,11 +89,10 @@ def configure_redirections(url_map):
# remove the initial "/" because src is a relative file path
src = (urlparse(k).path + 'index.html')[1:]
dst = (urlparse(v).path)
if src == 'index.html':
if src == index:
utils.LOGGER.warn("Can't do a redirect for: {0!r}".format(k))
else:
redirections.append((src, dst))

return redirections

def generate_base_site(self):
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/command/github_deploy.py
Expand Up @@ -53,7 +53,7 @@ def check_ghp_import_installed():
except OSError:
# req_missing defaults to `python=True` — and it’s meant to be like this.
# `ghp-import` is installed via pip, but the only way to use it is by executing the script it installs.
req_missing(['ghp-import'], 'deploy the site to GitHub Pages')
req_missing(['ghp-import2'], 'deploy the site to GitHub Pages')


class CommandGitHubDeploy(Command):
Expand Down
2 changes: 1 addition & 1 deletion nikola/plugins/command/import_wordpress.py
Expand Up @@ -334,7 +334,7 @@ def show_info_about_mising_module(modulename):
self.context['TRANSLATIONS'] = format_default_translations_config(
self.extra_languages)
self.context['REDIRECTIONS'] = self.configure_redirections(
self.url_map)
self.url_map, self.base_dir)
if self.timezone:
self.context['TIMEZONE'] = self.timezone
if self.export_categories_as_categories:
Expand Down

0 comments on commit 304b9e5

Please sign in to comment.