Permalink
Browse files

Shorten URL in tooltips to '[doc]'.

Addresses comment in issue #68.
  • Loading branch information...
1 parent df34fe1 commit fec3a37e3be5cb4a61eb9c881b0490548f1a4266 @tansongyang tansongyang committed with marijnh Nov 25, 2015
Showing with 15 additions and 5 deletions.
  1. +15 −5 utils/renderer.py
View
@@ -87,7 +87,7 @@ def get_html_message_from_ftype(ftype, argpos):
template_data = {
'style': style,
'func_signature': hint_line(func_signature),
- 'doc_link': hint_line(link(ftype['url'])),
+ 'doc_link': hint_line(link(ftype['url'], '[docs]')),
'doc': hint_line(doc)
}
@@ -118,18 +118,28 @@ def get_description_message(useHTML, type, doc=None, url=None):
def maybe(fn):
- def maybe_fn(arg):
- return fn(arg) if arg else ''
+ def maybe_fn(arg, *args, **kwargs):
+ return fn(arg, *args, **kwargs) if arg else ''
return maybe_fn
+
@maybe
-def link(url):
- return '<a href={url}>{url}</a>'.format(url=url)
+def link(url, linkText='{url}'):
+ """Returns a link HTML string.
+
+ The string is an &lt;a&gt; tag that links to the given url.
+ If linkText is not provided, the link text will be the url.
+ """
+
+ template = '<a href={url}>' + linkText + '</a>'
+ return template.format(url=url)
+
@maybe
def hint_line(txt):
return '<div class="hint-line-content">{txt}</div>'.format(txt=txt)
+
def go_to_url(url=None):
if url:
import webbrowser

0 comments on commit fec3a37

Please sign in to comment.