Fix highlighting in blame view.
This commit is contained in:
parent
a93f7099fa
commit
4be80f8aa3
3 changed files with 7 additions and 4 deletions
|
@ -20,6 +20,7 @@ v 8.4.2 (unreleased)
|
|||
improvement when checking if a repository was empty
|
||||
- Add instrumentation for Gitlab::Git::Repository instance methods so we can
|
||||
track them in Performance Monitoring.
|
||||
- Fix highlighting in blame view.
|
||||
|
||||
v 8.4.2 (unreleased)
|
||||
- Fix method undefined when using external commit status in builds
|
||||
|
|
|
@ -18,7 +18,10 @@ class Projects::BlameController < Projects::ApplicationController
|
|||
groups = []
|
||||
current_group = nil
|
||||
|
||||
highlighted_lines = Gitlab::Highlight.highlight(@blob.name, @blob.data).lines
|
||||
i = 0
|
||||
blame.each do |commit, line|
|
||||
line = highlighted_lines[i].html_safe
|
||||
if prev_sha && prev_sha == commit.sha
|
||||
current_group[:lines] << line
|
||||
else
|
||||
|
@ -27,6 +30,7 @@ class Projects::BlameController < Projects::ApplicationController
|
|||
end
|
||||
|
||||
prev_sha = commit.sha
|
||||
i += 1
|
||||
end
|
||||
|
||||
groups << current_group if current_group.present?
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
.file-content.blame.code.js-syntax-highlight
|
||||
%table
|
||||
- current_line = 1
|
||||
- blame_highlighter = highlighter(@blob.name, @blob.data, nowrap: true)
|
||||
- @blame.each do |blame_group|
|
||||
%tr
|
||||
%td.blame-commit
|
||||
|
@ -38,8 +37,7 @@
|
|||
\
|
||||
- current_line += line_count
|
||||
%td.lines
|
||||
%pre{class: 'code highlight'}
|
||||
%pre.code.highlight
|
||||
%code
|
||||
- blame_group[:lines].each do |line|
|
||||
:preserve
|
||||
#{blame_highlighter.highlight(line)}
|
||||
#{line}
|
||||
|
|
Loading…
Reference in a new issue