diff options
author | Rubén Dávila <rdavila84@gmail.com> | 2015-12-30 00:52:50 -0500 |
---|---|---|
committer | Rubén Dávila <rdavila84@gmail.com> | 2015-12-30 00:52:50 -0500 |
commit | bb96d631537d3d8181f0d3b762603a012219c3e6 (patch) | |
tree | 3520e34f8f99dd1a3a401ee83d1cb067cd9e3e66 /app/helpers/blob_helper.rb | |
parent | c031b9d9cd1ea41ab68f46eb5e630efaf901933a (diff) | |
download | gitlab-ce-bb96d631537d3d8181f0d3b762603a012219c3e6.tar.gz |
New implementation for highlighting diff files. #3945
* It is more performant given now we process all the diff file instead
of processing line by line.
* Multiline comments are highlighted correctly.
Diffstat (limited to 'app/helpers/blob_helper.rb')
-rw-r--r-- | app/helpers/blob_helper.rb | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index bf18673972c..1230002e69c 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -24,21 +24,6 @@ module BlobHelper result end - def highlight_line(blob_name, content, continue: false) - if @previous_blob_name != blob_name - @parent = Rouge::Lexer.guess(filename: blob_name, source: content).new rescue Rouge::Lexers::PlainText.new - @lexer = Rouge::Lexers::GitlabDiff.new(parent_lexer: @parent) - @options = Rouge::Lexers::PlainText === @parent ? {} : { continue: continue } - end - - @previous_blob_name = blob_name - @formatter ||= rouge_formatter(nowrap: true) - - content.sub!(/\A((?:\+|-)\s*)/, '') # Don't format '+' or '-' indicators. - - "#{$1}#{@formatter.format(@lexer.lex(content, @options))}".html_safe - end - def no_highlight_files %w(credits changelog news copying copyright license authors) end |