diff --git a/progit/__init__.py b/progit/__init__.py index 47b9f26..40c117d 100644 --- a/progit/__init__.py +++ b/progit/__init__.py @@ -238,7 +238,7 @@ def format_ts(string): @APP.template_filter('format_loc') -def format_loc(loc, commit=None, prequest=None): +def format_loc(loc, commit=None, prequest=None, index=None): """ Template filter putting the provided lines of code into a table """ output = [ @@ -257,19 +257,23 @@ def format_loc(loc, commit=None, prequest=None): for key in comments: comments[key] = sorted(comments[key], key=lambda obj: obj.date_created) + if not index: + index = '' + cnt = 1 for line in loc.split('\n'): if commit: output.append( '' - '%(cnt)s' + '%(cnt_lbl)s' '' '

' 'Add comment' '

' '' % ( { - 'cnt': cnt, + 'cnt': '%s_%s' % (index, cnt), + 'cnt_lbl': cnt, 'img': flask.url_for('static', filename='users.png'), 'commitid': commit.oid.hex, } @@ -279,7 +283,12 @@ def format_loc(loc, commit=None, prequest=None): output.append( '' '%(cnt)s' - % ({'cnt': cnt}) + % ( + { + 'cnt': '%s_%s' % (index, cnt), + 'cnt_lbl': cnt, + } + ) ) cnt += 1