Make html_for_tweet() link a replied-to username
If a tweet was a reply, then when `html_for_tweet()` tried to turn
the initial "@username" into a link, there was:
> NameError: name 'sub_expr' is not defined
This is now fixed, with a test to ensure the "@username" becomes
a link.
This commit is contained in:
parent
97f78fd89b
commit
0ee9b76b5c
3 changed files with 13 additions and 2 deletions
|
|
@ -578,6 +578,9 @@ class Twython(EndpointsMixin, object):
|
|||
temp['replacement'] = mention_html
|
||||
entities.append(temp)
|
||||
else:
|
||||
# Make the '@username' at the start, before
|
||||
# display_text, into a link:
|
||||
sub_expr = r'(?<!>)' + orig_tweet_text[temp['start']:temp['end']] + '(?!</a>)'
|
||||
prefix_text = re.sub(sub_expr, mention_html, prefix_text)
|
||||
|
||||
# Hashtags
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue