diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-01-14 15:11:50 +0100 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-01-14 15:11:50 +0100 |
commit | 3a1d0535992594bc77320f081d1f20b760b1c1f7 (patch) | |
tree | 01648b2b11bf9a3cdc012bda4da62eaf075650fe /lib/gitlab/diff | |
parent | c881627d114eb9c050d605e93673ef65a9da9a58 (diff) | |
download | gitlab-ce-3a1d0535992594bc77320f081d1f20b760b1c1f7.tar.gz |
Remove duplication around highlighting.
Diffstat (limited to 'lib/gitlab/diff')
-rw-r--r-- | lib/gitlab/diff/highlight.rb | 13 |
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) |