FIX: do not replace hashtags in URLs

This commit is contained in:
Arpit Jalan 2018-05-17 00:34:17 +05:30
parent 6cd0b7316a
commit 2a9b4e4bb5
1 changed files with 3 additions and 3 deletions

View File

@ -66,15 +66,15 @@ class TwitterApi
def link_hashtags_in(text)
text.scan(/(?:^|\s)#(\w+)/).flatten.uniq.each do |hashtag|
text.gsub!("##{hashtag}", [
"<a href='https://twitter.com/search?q=%23#{hashtag}' ",
text.gsub!(/(?:^|\s)##{hashtag}/, [
" <a href='https://twitter.com/search?q=%23#{hashtag}' ",
"target='_blank'>",
"##{hashtag}",
"</a>"
].join)
end
text
text.strip
end
def user_timeline_uri_for(screen_name)