diff --git a/progit/__init__.py b/progit/__init__.py index f5d06de..9af0e3c 100644 --- a/progit/__init__.py +++ b/progit/__init__.py @@ -237,7 +237,7 @@ def rst2html(rst_string): @APP.template_filter('format_loc') -def format_loc(loc): +def format_loc(loc, commit=None): """ Template filter putting the provided lines of code into a table """ output = [ @@ -246,9 +246,29 @@ def format_loc(loc): ] cnt = 1 for line in loc.split('\n'): - output.append( - '%s' % ( - cnt, cnt, cnt)) + if commit: + output.append( + '' + '%(cnt)s' + '' + '

' + 'Add comment' + '

' + '' % ( + { + 'cnt': cnt, + 'img': flask.url_for('static', filename='users.png'), + 'commitid': commit.oid.hex, + } + ) + ) + else: + output.append( + '' + '%(cnt)s' + % ({'cnt': cnt}) + ) + cnt += 1 if not line: output.append(line)