diff --git a/zephyr/lib/bugdown/__init__.py b/zephyr/lib/bugdown/__init__.py index 9f6df53730..baa8213d08 100644 --- a/zephyr/lib/bugdown/__init__.py +++ b/zephyr/lib/bugdown/__init__.py @@ -6,12 +6,10 @@ from zephyr.lib.bugdown import codehilite class Gravatar(markdown.inlinepatterns.Pattern): def handleMatch(self, match): - # NB: the first match of our regex is match.group(2) due to - # markdown internal matches img = markdown.util.etree.Element('img') img.set('class', 'message_body_gravatar img-rounded') img.set('src', 'https://secure.gravatar.com/avatar/%s?d=identicon&s=30' - % (gravatar_hash(match.group(2)),)) + % (gravatar_hash(match.group('email')),)) return img class Bugdown(markdown.Extension): @@ -21,7 +19,7 @@ class Bugdown(markdown.Extension): del md.parser.blockprocessors['hashheader'] del md.parser.blockprocessors['setextheader'] - md.inlinePatterns.add('gravatar', Gravatar(r'!gravatar\(([^)]*)\)'), '_begin') + md.inlinePatterns.add('gravatar', Gravatar(r'!gravatar\((?P[^)]*)\)'), '_begin') # We need to re-initialize the markdown engine every 30 messages # due to some sort of performance leak in the markdown library.