Skip to content

Commit

Permalink
Passing url_type into template context.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Oct 23, 2016
1 parent 223bb2a commit cd0e59e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -13,6 +13,7 @@ Features
* The destination folder in ``POSTS`` and ``PAGES`` can now be
translated (Issue #2116)
* Pass ``post`` object and ``lang`` to post compilers (Issue #2531)
* Pass ``url_type`` into template's context.

New in v7.8.1
=============
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/base-jinja/templates/base_helper.tmpl
Expand Up @@ -60,7 +60,7 @@ lang="{{ lang }}">
{% if use_cdn %}
<!--[if lt IE 9]><script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
{% else %}
<!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5.js', lang) }}"></script><![endif]-->
<!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5.js', lang, url_type) }}"></script><![endif]-->
{% endif %}

{{ extra_head_data }}
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/base/templates/base_helper.tmpl
Expand Up @@ -60,7 +60,7 @@ lang="${lang}">
%if use_cdn:
<!--[if lt IE 9]><script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
%else:
<!--[if lt IE 9]><script src="${url_replacer(permalink, '/assets/js/html5.js', lang)}"></script><![endif]-->
<!--[if lt IE 9]><script src="${url_replacer(permalink, '/assets/js/html5.js', lang, url_type)}"></script><![endif]-->
%endif

${extra_head_data}
Expand Down
Expand Up @@ -65,7 +65,7 @@ lang="{{ lang }}">
{% if use_cdn %}
<!--[if lt IE 9]><script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
{% else %}
<!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5.js', lang) }}"></script><![endif]-->
<!--[if lt IE 9]><script src="{{ url_replacer(permalink, '/assets/js/html5.js', lang, url_type) }}"></script><![endif]-->
{% endif %}

{{ extra_head_data }}
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/themes/bootstrap3/templates/base_helper.tmpl
Expand Up @@ -65,7 +65,7 @@ lang="${lang}">
%if use_cdn:
<!--[if lt IE 9]><script src="https://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
%else:
<!--[if lt IE 9]><script src="${url_replacer(permalink, '/assets/js/html5.js', lang)}"></script><![endif]-->
<!--[if lt IE 9]><script src="${url_replacer(permalink, '/assets/js/html5.js', lang, url_type)}"></script><![endif]-->
%endif

${extra_head_data}
Expand Down
1 change: 1 addition & 0 deletions nikola/nikola.py
Expand Up @@ -1306,6 +1306,7 @@ def render_template(self, template_name, output_name, context, url_type=None):
for k in self._GLOBAL_CONTEXT_TRANSLATABLE:
local_context[k] = local_context[k](local_context['lang'])
local_context['is_rtl'] = local_context['lang'] in LEGAL_VALUES['RTL_LANGUAGES']
local_context['url_type'] = self.site.config['URL_TYPE'] if url_type is None else url_type
# string, arguments
local_context["formatmsg"] = lambda s, *a: s % a
for h in local_context['template_hooks'].values():
Expand Down

0 comments on commit cd0e59e

Please sign in to comment.