Skip to content

Commit

Permalink
Merge pull request #58 from codota/issue/fix-display-urls
Browse files Browse the repository at this point in the history
fix urls display value
  • Loading branch information
dimacodota authored Apr 23, 2020
2 parents d652399 + cd68afc commit f6fd1e2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions TabNine.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,13 +470,15 @@ def escape(s):
urls = [
('https://tabnine.com/semantic', None, 'tabnine.com/semantic'),
('tabnine.com/semantic', 'https://tabnine.com/semantic', 'tabnine.com/semantic'),
('tabnine.com', 'https://tabnine.com', 'tabnine.com', 'tabnine.com/buy', 'www.tabnine.com/buy'),
('www.tabnine.com/buy', 'https://tabnine.com/buy', 'tabnine.com/buy'),
('tabnine.com', 'https://tabnine.com', 'tabnine.com'),

]
for url, navigate_to, display in urls:
if url in s:
if navigate_to is None:
navigate_to = url
s = s.replace(html.escape(url), '<a href="{}">{}</a>'.format(url, display))
s = s.replace(html.escape(url), '<a href="{}">{}</a>'.format(navigate_to, display))
break
return s

Expand Down

0 comments on commit f6fd1e2

Please sign in to comment.