diff options
author | Douwe Maan <douwe@gitlab.com> | 2016-01-14 16:52:08 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2016-01-14 16:52:08 +0300 |
commit | c881627d114eb9c050d605e93673ef65a9da9a58 (patch) | |
tree | 17038fbc42e42b215a163abda8e62bff64c6d7fa /app/helpers/blob_helper.rb | |
parent | c179b48c97be22ef55ef9f5874984f7359fb12f1 (diff) |
Refactor parallel_diff generation a bit.
Diffstat (limited to 'app/helpers/blob_helper.rb')
-rw-r--r-- | app/helpers/blob_helper.rb | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb index a80162a3e33..84e3cbb380b 100644 --- a/app/helpers/blob_helper.rb +++ b/app/helpers/blob_helper.rb @@ -13,15 +13,8 @@ module BlobHelper def highlight(blob_name, blob_content, nowrap: false, continue: false) formatter = rouge_formatter(nowrap: nowrap) - begin - @lexer ||= Rouge::Lexer.guess(filename: blob_name, source: blob_content).new - result = formatter.format(@lexer.lex(blob_content, continue: continue)).html_safe - rescue - @lexer = Rouge::Lexers::PlainText - result = formatter.format(@lexer.lex(blob_content)).html_safe - end - - result + @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 end def no_highlight_files |