Skip to content
Snippets Groups Projects
Commit dfce7b62 authored by Hannes Rosenögger's avatar Hannes Rosenögger
Browse files

workaround for buggy lexers

if something goes wrong, fall back to the plaintext lexer
parent 76a75823
No related branches found
No related tags found
No related merge requests found
Loading
@@ -4,6 +4,7 @@ v 7.12.0 (unreleased)
Loading
@@ -4,6 +4,7 @@ v 7.12.0 (unreleased)
- Allow to configure location of the `.gitlab_shell_secret` file. (Jakub Jirutka) - Allow to configure location of the `.gitlab_shell_secret` file. (Jakub Jirutka)
   
v 7.11.0 (unreleased) v 7.11.0 (unreleased)
- Fall back to Plaintext when Syntaxhighlighting doesn't work. Fixes some buggy lexers (Hannes Rosenögger)
- Fix broken view when viewing history of a file that includes a path that used to be another file (Stan Hu) - Fix broken view when viewing history of a file that includes a path that used to be another file (Stan Hu)
- Don't show duplicate deploy keys - Don't show duplicate deploy keys
- Fix commit time being displayed in the wrong timezone in some cases (Hannes Rosenögger) - Fix commit time being displayed in the wrong timezone in some cases (Hannes Rosenögger)
Loading
Loading
Loading
@@ -9,11 +9,13 @@ module BlobHelper
Loading
@@ -9,11 +9,13 @@ module BlobHelper
   
begin begin
lexer = Rugments::Lexer.guess(filename: blob_name, source: blob_content) lexer = Rugments::Lexer.guess(filename: blob_name, source: blob_content)
rescue Rugments::Lexer::AmbiguousGuess result = formatter.format(lexer.lex(blob_content)).html_safe
rescue
lexer = Rugments::Lexers::PlainText lexer = Rugments::Lexers::PlainText
result = formatter.format(lexer.lex(blob_content)).html_safe
end end
   
formatter.format(lexer.lex(blob_content)).html_safe result
end end
   
def no_highlight_files def no_highlight_files
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment