Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Bug fixes.

  • Loading branch information...
commit 78323c6c414897a10c41ae56f780bca705b9ea03 1 parent be910e6
@streeter authored
Showing with 8 additions and 7 deletions.
  1. +1 −1  pelican_gist/__init__.py
  2. +7 −6 pelican_gist/plugin.py
View
2  pelican_gist/__init__.py
@@ -1,5 +1,5 @@
__title__ = 'pelican-gist'
-__version__ = '0.1.0'
+__version__ = '0.1.1'
__author__ = 'Chris Streeter'
__license__ = 'MIT'
__copyright__ = 'Copyright 2013'
View
13 pelican_gist/plugin.py
@@ -13,18 +13,15 @@
import os
import re
-from jinja2 import Template
-from pelican import signals
-
logger = logging.getLogger(__name__)
gist_regex = re.compile(r'(<p>\[gist:id\=([0-9]+),file\=([^\]]+)\]</p>)')
-gist_template = Template("""<div class="gist">
+gist_template = """<div class="gist">
<script src='{{script_url}}'></script>
<noscript>
<pre><code>{{code}}</code></pre>
</noscript>
-</div>""")
+</div>"""
def html_output(script_url, code):
@@ -90,6 +87,9 @@ def setup_gist(pelican):
def replace_gist_tags(generator):
"""Replace gist tags in the article content."""
+ from jinja2 import Template
+ template = Template(gist_template)
+
should_cache = generator.context.get('GIST_CACHE_ENABLED')
cache_location = generator.context.get('GIST_CACHE_LOCATION')
@@ -124,13 +124,14 @@ def replace_gist_tags(generator):
})
# Render the template
- replacement = gist_template.render(context)
+ replacement = template.render(context)
article._content = article._content.replace(match[0], replacement)
def register():
"""Plugin registration."""
+ from pelican import signals
signals.initialized.connect(setup_gist)
Please sign in to comment.
Something went wrong with that request. Please try again.