Fix 500s because of "missing" lexer

This commit is contained in:
Riyad Preukschas 2012-11-10 00:55:56 +01:00
parent 6cec9ed328
commit ca54d43f99

View file

@ -10,10 +10,12 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
end
def block_code(code, language)
options = { options: {encoding: 'utf-8'} }
if Pygments::Lexer.find(language)
Pygments.highlight(code, lexer: language, options: {encoding: 'utf-8'})
Pygments.highlight(code, options.merge(lexer: language.downcase))
else
Pygments.highlight(code, options: {encoding: 'utf-8'})
Pygments.highlight(code, options)
end
end