Skip to content

Commit 14f00ef

Browse files
committedMay 24, 2015
baby steps
1 parent 4d3a779 commit 14f00ef

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed
 

‎v7/jade/jade.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
try:
3333
import jinja2
3434
from jinja2 import meta
35+
import pyjade
3536
except ImportError:
36-
jinja2 = None # NOQA
37-
import pyjade
37+
pyjade = None # NOQA
3838

3939
from nikola.plugin_categories import TemplateSystem
4040
from nikola.utils import makedirs, req_missing
@@ -49,17 +49,17 @@ class JinjaTemplates(TemplateSystem):
4949

5050
def __init__(self):
5151
""" initialize Jinja2 wrapper with extended set of filters"""
52-
if jinja2 is None:
53-
return
52+
if pyjade is None:
53+
req_missing(['pyjade'], 'build this site (compile Jade)')
5454
self.lookup = jinja2.Environment(extensions=['pyjade.ext.jinja.PyJadeExtension'])
5555
self.lookup.filters['tojson'] = json.dumps
5656
self.lookup.filters['istuple'] = lambda x: isinstance(x, tuple)
5757
self.lookup.globals['enumerate'] = enumerate
5858

5959
def set_directories(self, directories, cache_folder):
6060
"""Create a template lookup."""
61-
if jinja2 is None:
62-
req_missing(['jinja2'], 'use this theme')
61+
if pyjade is None:
62+
req_missing(['pyjade'], 'use this theme')
6363
self.lookup.loader = jinja2.FileSystemLoader(directories,
6464
encoding='utf-8')
6565

@@ -70,8 +70,8 @@ def set_site(self, site):
7070

7171
def render_template(self, template_name, output_name, context):
7272
"""Render the template into output_name using context."""
73-
if jinja2 is None:
74-
req_missing(['jinja2'], 'use this theme')
73+
if pyjade is None:
74+
req_missing(['pyjade'], 'use this theme')
7575
if not template_name.endswith('.jade'):
7676
template_name = os.path.splitext(template_name)[0]+'.jade'
7777
template = self.lookup.get_template(template_name)

0 commit comments

Comments
 (0)
Please sign in to comment.