summaryrefslogtreecommitdiff
path: root/lib/gitlab/diff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2016-01-14 15:11:50 +0100
committerDouwe Maan <douwe@gitlab.com>2016-01-14 15:11:50 +0100
commit3a1d0535992594bc77320f081d1f20b760b1c1f7 (patch)
tree01648b2b11bf9a3cdc012bda4da62eaf075650fe /lib/gitlab/diff
parentc881627d114eb9c050d605e93673ef65a9da9a58 (diff)
downloadgitlab-ce-3a1d0535992594bc77320f081d1f20b760b1c1f7.tar.gz
Remove duplication around highlighting.
Diffstat (limited to 'lib/gitlab/diff')
-rw-r--r--lib/gitlab/diff/highlight.rb13
1 files changed, 1 insertions, 12 deletions
diff --git a/lib/gitlab/diff/highlight.rb b/lib/gitlab/diff/highlight.rb
index e76a6f27856..f34eff62d79 100644
--- a/lib/gitlab/diff/highlight.rb
+++ b/lib/gitlab/diff/highlight.rb
@@ -20,18 +20,7 @@ module Gitlab
blob = repository.blob_at(ref, file_name)
return [] unless blob
- content = blob.data
- lexer = Rouge::Lexer.guess(filename: file_name, source: content).new rescue Rouge::Lexers::PlainText.new
- formatter.format(lexer.lex(content)).lines.map!(&:html_safe)
- end
-
- def self.formatter
- @formatter ||= Rouge::Formatters::HTMLGitlab.new(
- nowrap: true,
- cssclass: 'code highlight',
- lineanchors: true,
- lineanchorsid: 'LC'
- )
+ Gitlab::Highlight.highlight(file_name, blob.data).lines.map!(&:html_safe)
end
def initialize(diff_file)