--- a/candolint/adapters.py Tue Jul 05 20:48:01 2016 +0800
+++ b/candolint/adapters.py Tue Jul 05 21:02:50 2016 +0800
+from os.path import basename
class HostingAdapter(object):
def __init__(self, project):
def get_branch_url(self, change):
+ def get_line_url(self, change, line):
class BitbucketAdapter(HostingAdapter):
def get_commit_url(self, change):
+ def get_line_url(self, change, line):
+ return '{url}/src/{node}/{filename}#{basename}-{line_number}'.format(**{
+ 'url': self.project.url,
+ 'filename': line['filename'],
+ 'basename': basename(line['filename']),
+ 'line_number': line['line_number']
--- a/candolint/handlers.py Tue Jul 05 20:48:01 2016 +0800
+++ b/candolint/handlers.py Tue Jul 05 21:02:50 2016 +0800
def get_html(self, project, check, lines):
adapter = project.get_adapter()
+ line['link'] = adapter.get_line_url(check.change, line)
self.render('check.html', project=project, check=check, lines=lines, adapter=adapter)
--- a/static/main.css Tue Jul 05 20:48:01 2016 +0800
+++ b/static/main.css Tue Jul 05 21:02:50 2016 +0800
+ text-decoration: underline;
--- a/templates/check.html Tue Jul 05 20:48:01 2016 +0800
+++ b/templates/check.html Tue Jul 05 21:02:50 2016 +0800
#}{% for number, line in enumerate(lines, 1) %}{#
#}<div id="l{{ number }}"{% if 'task' in line %} data-task="{{ line['task'] }}"{% end %}{% if 'cls' in line %} class="{{ line['cls'] }}"{% end %}>{#
#}<a href="#l{{ number }}" class="lineno" data-line-number="{{ number }}"></a>{#
+ #}{% if 'link' in line %}{#
+ #}{{ line['text'][:line['link_start']] }}{#
+ #}<a href="{{ line['link'] }}" class="filelink">{#
+ #}{{ line['text'][line['link_start']:line['link_end']] }}{#
+ #}{{ line['text'][line['link_end']:] }}{#