diff --git a/static/css/clif.css b/static/css/clif.css index 2833fba..3a4612f 100644 --- a/static/css/clif.css +++ b/static/css/clif.css @@ -440,12 +440,6 @@ div.commit { padding: .5rem .5rem; } - div.commit details.diff_view .diff .lineno { - color: gray; - text-align: center; - width: 0; - } - div.commit details.diff_view .diff .origin { width: 0; } @@ -488,19 +482,27 @@ div.commit { .highlight { background: none; } - - .highlight .linenos { - border-right: 1px solid #aaa; - padding-right: .5rem; - } - - .highlight .linenos a, - .highlight .linenos a:hover, - .highlight .linenos a:visited { - color: gray; - text-decoration: none; - } .highlight .code { padding-left: 1rem; } + +/* Line numbers when showind diffs or blobs. + * Do not change class name, because this is an extension of the "lineos" class + * that is generated from Pygments. */ +.linenos { + border-right: 1px solid #aaa; + text-align: right; + width: 0; +} + +.linenos a, +.linenos a:hover, +.linenos a:visited { + color: gray; + text-decoration: none; +} + +.linenos a:hover { + color: black; +} diff --git a/templates/repository/commit.html b/templates/repository/commit.html index 3e8224e..9cd61dd 100644 --- a/templates/repository/commit.html +++ b/templates/repository/commit.html @@ -71,7 +71,9 @@ {% for patch in diff %} {{ patch.delta.new_file.mode|filemode }} - {{ patch.delta.new_file.path }} + + {{ patch.delta.new_file.path }} + {{ patch.line_stats[1] + patch.line_stats[2] }} {% if diff_stats.insertions + diff_stats.deletions > 0 %} @@ -202,7 +204,7 @@ @@ -252,14 +254,14 @@ {% for line in hunk.lines %} - - @@ -282,23 +284,23 @@ {% for buffer_del, buffer_ins in zip_longest(buffer_deletions, buffer_insertions) %} {% if buffer_del %} - {% else %} - {% endif %} {% if buffer_ins %} - {% else %} - {% endif %} @@ -334,13 +336,13 @@ {# Insert the unchanged line. #} - -
- index {{ (patch.delta.old_file.id|string)[:7] }}..{{ (patch.delta.new_file.id|string)[:7] }} + index {{ (patch.delta.old_file.id|string)[:7] }}..{{ (patch.delta.new_file.id|string)[:7] }}
+ {% if line.old_lineno >= 0 %} - {{ line.old_lineno }} + {{ line.old_lineno }} {% endif %} + {% if line.new_lineno >= 0 %} - {{ line.new_lineno }} + {{ line.new_lineno }} {% endif %} {{ line.origin }}
- {{ buffer_del.old_lineno }} + + {{ buffer_del.old_lineno }} {{ buffer_del.content }} + - {{ buffer_ins.new_lineno }} + + {{ buffer_ins.new_lineno }} {{ buffer_ins.content }} +
- {{ line.old_lineno }} + + {{ line.old_lineno }} {{ line.content }} - {{ line.new_lineno }} + + {{ line.new_lineno }} {{ line.content }}