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 /app/helpers | |
parent | c881627d114eb9c050d605e93673ef65a9da9a58 (diff) | |
download | gitlab-ce-3a1d0535992594bc77320f081d1f20b760b1c1f7.tar.gz |
Remove duplication around highlighting.
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/blob_helper.rb | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index 84e3cbb380b..be856242c43 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -1,20 +1,6 @@ module BlobHelper - def rouge_formatter(options = {}) - default_options = { - nowrap: false, - cssclass: 'code highlight', - lineanchors: true, - lineanchorsid: 'LC' - } - - Rouge::Formatters::HTMLGitlab.new(default_options.merge!(options)) - end - def highlight(blob_name, blob_content, nowrap: false, continue: false) - formatter = rouge_formatter(nowrap: nowrap) - - @lexer ||= Rouge::Lexer.guess(filename: blob_name, source: blob_content).new rescue Rouge::Lexers::PlainText - formatter.format(@lexer.lex(blob_content, continue: continue)).html_safe + Gitlab::Highlight.highlight(blob_name, blob_content, nowrap: nowrap, continue: continue) end def no_highlight_files |