From 211e7b9fbd89a16d0be62c49fe7e99d59cc52cf7 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Sun, 28 Aug 2016 15:49:00 +0100 Subject: [PATCH] use repo, because reasons unknown --- Makefile | 3 +++ pelicanconf.py | 2 +- plugins/jinja2content.py | 41 ---------------------------------------- 3 files changed, 4 insertions(+), 42 deletions(-) delete mode 100644 plugins/jinja2content.py diff --git a/Makefile b/Makefile index 40b059f..c367ba2 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,9 @@ install: env node_modules pelican_plugins pelican_plugins: env rm -rf $(PLUGINS_DIR) || "No existing extensions" git clone --recursive https://github.com/getpelican/pelican-plugins $(PLUGINS_DIR) || "Git Fail" + @echo ">> Hotfixing..." + rm -rf $(PLUGINS_DIR)/pelican-jinja2content + git clone https://github.com/RealOrangeOne/pelican-jinja2content -b patch-1 --depth=1 $(PLUGINS_DIR)/pelican-jinja2content env: pyvenv env diff --git a/pelicanconf.py b/pelicanconf.py index 274e4e0..8253887 100644 --- a/pelicanconf.py +++ b/pelicanconf.py @@ -62,7 +62,7 @@ PLUGIN_PATHS = ["pelican_plugins", "plugins"] PLUGINS = [ "sitemap", "filetime_from_git", - "jinja2content", + "pelican-jinja2content", "metatags", "autopages", "screenfetch" diff --git a/plugins/jinja2content.py b/plugins/jinja2content.py deleted file mode 100644 index 2ce866d..0000000 --- a/plugins/jinja2content.py +++ /dev/null @@ -1,41 +0,0 @@ -import os - -from pelican import signals -from pelican import contents - -from jinja2 import Environment, ChoiceLoader, FileSystemLoader - - -def execjinja2(instance): - if type(instance) in (contents.Article, contents.Page): - base_path = os.path.dirname(os.path.abspath(__file__)) - jinja2_env = Environment( - trim_blocks=True, - lstrip_blocks=True, - loader=ChoiceLoader([ - FileSystemLoader( - os.path.join(base_path, instance.settings['THEME'], 'templates') - ), - FileSystemLoader( - os.path.join(base_path, instance.settings['PATH']) - ) - ]), - extensions=instance.settings['JINJA_EXTENSIONS'], - ) - - if 'JINJA_FILTERS' in instance.settings: - jinja2_env.filters.update(instance.settings['JINJA_FILTERS']) - - jinja2_template = jinja2_env.from_string(instance._content) - - kwargs = instance._context - if type(instance) is contents.Article: - kwargs['article'] = instance - elif type(instance) is contents.Page: - kwargs['page'] = instance - - instance._content = jinja2_template.render(**kwargs) - - -def register(): - signals.content_object_init.connect(execjinja2)