Don't crash if pygments is not installed

This commit is contained in:
Gregory Soutade 2015-08-08 17:17:15 +02:00
parent a20936c7f7
commit 0b871656b5
2 changed files with 9 additions and 2 deletions

View File

@ -205,7 +205,8 @@ class Index(DynastieGenerator):
break
res = self.createCode(dom, dom.firstChild)
code = code.replace(code[start:end+11], res)
if res:
code = code.replace(code[start:end+11], res)
return code
@ -379,7 +380,7 @@ class Index(DynastieGenerator):
from pygments.formatters import get_formatter_by_name
except ImportError:
self.addError('Pygments package is missing, please install it in order to use <dyn:code>')
return
return None
language = node.getAttribute('language')

View File

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<ljdc>
<entry>
<id>124083117265</id>
<address>http://thecodinglove.com/post/124083117265/git-push-force</address>
<title>Git push --force</title>
<img>http://tclhost.com/cMusPk2.gif</img>
</entry>
<entry>
<id>117591456984</id>
<address>http://lesjoiesducode.fr/post/117591456984/quand-le-nouveau-essaie-de-suivre-le-dialogue</address>