Add tooltip for, e.g. !gravatar(wdaher@zulip.com) output.

(imported from commit eff24a2fc7da77edc26449074acf75832d368a17)
This commit is contained in:
Waseem Daher
2013-10-30 11:52:28 -04:00
parent 5991d19013
commit db1f5065a7
2 changed files with 6 additions and 2 deletions

View File

@@ -2791,6 +2791,7 @@ div.edit_bot {
.message_body_gravatar {
width: 20px;
height: 20px;
border-radius: 10px;
margin: 2px 2px 2px 0px;
border: 1px solid #000;
}

View File

@@ -341,9 +341,12 @@ class InlineInterestingLinkProcessor(markdown.treeprocessors.Treeprocessor):
class Gravatar(markdown.inlinepatterns.Pattern):
def handleMatch(self, match):
img = markdown.util.etree.Element('img')
img.set('class', 'message_body_gravatar img-rounded')
email_address = match.group('email')
img.set('class', 'message_body_gravatar')
img.set('src', 'https://secure.gravatar.com/avatar/%s?d=identicon&s=30'
% (gravatar_hash(match.group('email')),))
% (gravatar_hash(email_address),))
img.set('title', email_address)
img.set('alt', email_address)
return img
path_to_emoji = os.path.join(os.path.dirname(__file__), '..', '..', '..',