Skip to content
Permalink
Browse files

Merge branch 'master' into fixing-post-dependencies

  • Loading branch information
felixfontein committed Nov 20, 2016
2 parents 8899b24 + 0ecaff5 commit 8502aa748a66728ae155068772a3d8b866c64d3e
Showing with 22 additions and 12 deletions.
  1. +3 −1 CHANGES.txt
  2. +6 −3 docs/manual.txt
  3. +8 −3 nikola/nikola.py
  4. +1 −1 nikola/plugins/command/new_post.py
  5. +2 −2 nikola/plugins/task/py3_switch.py
  6. +2 −2 requirements-tests.txt
@@ -4,8 +4,10 @@ New in master
Bugfixes
--------

* Make "data" from global context available to templated shortcodes (Issue #2488)
* Make ``data`` from global context available to templated shortcodes
as ``global_data`` (Issue #2488)
* Don't crash if plugins is a file (Issue #2539)
* Don't mangle bare ``#`` links (Issue #2553)

Features
--------
@@ -1086,9 +1086,10 @@ In that case, the template engine used will be your theme's and the arguments yo
as well as the global context from your ``conf.py``, are available to the template you
are creating.

You can use anything defined in your confguration's ``GLOBAL_CONTEXT`` as variables in your
shortcode template, with a caveat: Because of an unfortunate implementation detail, data is called
"global_data" when used in a shortcode.
You can use anything defined in your confguration's ``GLOBAL_CONTEXT`` as
variables in your shortcode template, with a caveat: Because of an unfortunate
implementation detail (a name conflict), ``data`` is called ``global_data``
when used in a shortcode.

The Global Context and Data files
---------------------------------
@@ -1119,6 +1120,8 @@ JSON/YAML/TOML files and Nikola generates a large page with data from all data
files. (This is especially useful with some automatic rebuild feature, like
those documented in `Deployment`_)

Data files are also available as ``global_data``, to avoid name conflicts in
shortcodes. (``global_data`` works everywhere.)

Redirections
------------
@@ -1165,6 +1165,8 @@ def _set_global_context_from_data(self):
data = utils.load_data(fname)
key = os.path.splitext(fname.split(os.sep, 1)[1])[0]
self._GLOBAL_CONTEXT['data'][key] = data
# Offer global_data as an alias for data (Issue #2488)
self._GLOBAL_CONTEXT['global_data'] = self._GLOBAL_CONTEXT['data']

def _activate_plugins_of_category(self, category):
"""Activate all the plugins of a given category and return them."""
@@ -1379,6 +1381,10 @@ def url_replacer(self, src, dst, lang=None, url_type=None):
lang is used for language-sensitive URLs in link://
url_type is used to determine final link appearance, defaulting to URL_TYPE from config
"""
# Avoid mangling links within the page
if dst.startswith('#'):
return dst

parsed_src = urlsplit(src)
src_elems = parsed_src.path.split('/')[1:]
dst_url = urlparse(dst)
@@ -1492,13 +1498,12 @@ def _make_renderfunc(self, t_data, fname=None):
Global context keys are made available as part of the context,
respecting locale.
As a special quirk, the "data" key from global_context is made
available as "global_data" because of name clobbering.
As a special quirk, the "data" key from global_context is
available only as "global_data" because of name clobbering.
"""
def render_shortcode(*args, **kw):
context = self.GLOBAL_CONTEXT.copy()
context['global_data'] = context['data']
context.update(kw)
context['_args'] = args
context['lang'] = utils.LocaleBorg().current_lang
@@ -262,7 +262,7 @@ def _execute(self, options, args):
self.site.config['post_pages'])

if content_format not in compiler_names:
LOGGER.error("Unknown {0} format {1}, maybe you need to install a plugin?".format(content_type, content_format))
LOGGER.error("Unknown {0} format {1}, maybe you need to install a plugin or enable an existing one?".format(content_type, content_format))
self.print_compilers()
return
compiler_plugin = self.site.plugin_manager.getPluginByName(
@@ -36,12 +36,12 @@
from nikola.utils import get_logger, STDERR_HANDLER
from nikola.plugin_categories import LateTask

PY2_AND_NO_PY3_WARNING = """Nikola is going to deprecate Python 2 support in 2016. Your current
PY2_AND_NO_PY3_WARNING = """Nikola is going to deprecate Python 2 support in 2016 (or 2017). Your current
version will continue to work, but please consider upgrading to Python 3.
Please check http://bit.ly/1FKEsiX for details.
"""
PY2_WARNING = """Nikola is going to deprecate Python 2 support in 2016. You already have Python 3
PY2_WARNING = """Nikola is going to deprecate Python 2 support in 2016 (or 2017). You already have Python 3
available in your system. Why not switch?
Please check http://bit.ly/1FKEsiX for details.
@@ -1,8 +1,8 @@
-r requirements-extras.txt
mock==2.0.0
coverage==4.2
pytest==3.0.3
pytest==3.0.4
pytest-cov==2.4.0
freezegun==0.3.7
freezegun==0.3.8
python-coveralls==2.9.0
colorama>=0.3.4

0 comments on commit 8502aa7

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