diff options
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 |