From cc0dd7f2d3b3eff253ba2712df24bb6b34021af2 Mon Sep 17 00:00:00 2001 From: Deniz Turgut Date: Thu, 15 Dec 2016 04:18:20 -0500 Subject: [PATCH] Update plugins that use JINJA_ENTENSIONS to the Pelican 3.7 setting JINJA_ENVIRONMENT Plugins that were affected: - assets - i18n_subsites - jinja2content --- i18n_subsites.py | 8 +++++++- test_data/output/an-untranslated-article.html | 5 ++--- .../output/cz/an-untranslated-article-en.html | 5 ++--- test_data/output/cz/feeds_all.atom.xml | 18 +++++++++++++----- test_data/output/cz/index.html | 4 ++-- test_data/output/cz/translated-article.html | 5 ++--- .../de/drafts/an-untranslated-article-en.html | 7 +++---- test_data/output/de/feeds_all.atom.xml | 14 ++++++++++---- test_data/output/de/index.html | 2 +- test_data/output/de/translated-article.html | 7 +++---- test_data/output/feeds_all.atom.xml | 18 +++++++++++++----- test_data/output/index.html | 4 ++-- test_data/output/translated-article.html | 5 ++--- test_data/pelicanconf.py | 2 +- 14 files changed, 63 insertions(+), 41 deletions(-) diff --git a/i18n_subsites.py b/i18n_subsites.py index 7361d16..388e758 100644 --- a/i18n_subsites.py +++ b/i18n_subsites.py @@ -270,7 +270,13 @@ def install_templates_translations(generator): Only if the 'jinja2.ext.i18n' jinja2 extension is enabled the translations for the current DEFAULT_LANG are installed. ''' - if 'jinja2.ext.i18n' in generator.settings['JINJA_EXTENSIONS']: + if 'JINJA_ENVIRONMENT' in generator.settings: # pelican 3.7+ + jinja_extensions = generator.settings['JINJA_ENVIRONMENT'].get( + 'extensions', []) + else: + jinja_extensions = generator.settings['JINJA_EXTENSIONS'] + + if 'jinja2.ext.i18n' in jinja_extensions: domain = generator.settings.get('I18N_GETTEXT_DOMAIN', 'messages') localedir = generator.settings.get('I18N_GETTEXT_LOCALEDIR') if localedir is None: diff --git a/test_data/output/an-untranslated-article.html b/test_data/output/an-untranslated-article.html index 880f90e..f45a103 100644 --- a/test_data/output/an-untranslated-article.html +++ b/test_data/output/an-untranslated-article.html @@ -9,7 +9,6 @@ - @@ -27,9 +26,9 @@