Make Twitter preview look like other inline image previews.

(imported from commit ca4ff9146679a5348bf53d06e992972e9a4b628a)
This commit is contained in:
Waseem Daher 2014-01-10 15:08:13 -05:00
parent b880b9426f
commit fe748f7633
3 changed files with 6 additions and 9 deletions

View File

@ -2001,7 +2001,7 @@ div.floating_recipient {
} }
.message_inline_image { .twitter-image, .message_inline_image {
margin-bottom: 5px; margin-bottom: 5px;
margin-left: 5px; margin-left: 5px;
height: 100px; height: 100px;
@ -2009,7 +2009,7 @@ div.floating_recipient {
border: none !important; border: none !important;
} }
.message_inline_image img { .twitter-image img, .message_inline_image img {
height: auto; height: auto;
max-height: 100%; max-height: 100%;
} }
@ -2619,10 +2619,6 @@ li.expanded_subject {
margin-right: .75em; margin-right: .75em;
} }
.twitter-image {
display: block;
}
.star { .star {
display: inline-block; display: inline-block;
opacity: 1; opacity: 1;

View File

@ -330,13 +330,14 @@ class InlineInterestingLinkProcessor(markdown.treeprocessors.Treeprocessor):
break break
media_url = '%s:%s' % (media_item['media_url_https'], size_name) media_url = '%s:%s' % (media_item['media_url_https'], size_name)
img_a = markdown.util.etree.SubElement(tweet, 'a') img_div = markdown.util.etree.SubElement(tweet, 'div')
img_div.set('class', 'twitter-image')
img_a = markdown.util.etree.SubElement(img_div, 'a')
img_a.set('href', media_item['url']) img_a.set('href', media_item['url'])
img_a.set('target', '_blank') img_a.set('target', '_blank')
img_a.set('title', media_item['url']) img_a.set('title', media_item['url'])
img = markdown.util.etree.SubElement(img_a, 'img') img = markdown.util.etree.SubElement(img_a, 'img')
img.set('src', media_url) img.set('src', media_url)
img.set('class', 'twitter-image')
return tweet return tweet
except: except:

View File

@ -4354,7 +4354,7 @@ xxxxxxx</strong></p>\n<p>xxxxxxx xxxxx xxxx xxxxx:<br>\n<code>xxxxxx</code>: xxx
converted = bugdown_convert(msg) converted = bugdown_convert(msg)
self.assertEqual(converted, '<p>%s</p>\n%s' % (make_link('http://twitter.com/wdaher/status/287977969287315459'), self.assertEqual(converted, '<p>%s</p>\n%s' % (make_link('http://twitter.com/wdaher/status/287977969287315459'),
make_inline_twitter_preview('http://twitter.com/wdaher/status/287977969287315459', media_tweet_html, """<a href="http://t.co/xo7pAhK6n3" target="_blank" title="http://t.co/xo7pAhK6n3"><img class="twitter-image" src="https://pbs.twimg.com/media/BdoEjD4IEAIq86Z.jpg:small"></a>"""))) make_inline_twitter_preview('http://twitter.com/wdaher/status/287977969287315459', media_tweet_html, """<div class="twitter-image"><a href="http://t.co/xo7pAhK6n3" target="_blank" title="http://t.co/xo7pAhK6n3"><img src="https://pbs.twimg.com/media/BdoEjD4IEAIq86Z.jpg:small"></a></div>""")))
def test_emoji(self): def test_emoji(self):
def emoji_img(name, filename=None): def emoji_img(name, filename=None):