From 409b0a0ab557dcc146e3123e976a4634f3d05877 Mon Sep 17 00:00:00 2001 From: Sytse Sijbrandij Date: Sun, 9 Jun 2013 21:30:20 +0200 Subject: [PATCH] Fix pygment lexer 500 errors when an alias is used instead of a name. --- lib/redcarpet/render/gitlab_html.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb index 4f2c86e2d41..318adbf1894 100644 --- a/lib/redcarpet/render/gitlab_html.rb +++ b/lib/redcarpet/render/gitlab_html.rb @@ -11,7 +11,8 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML def block_code(code, language) options = { options: {encoding: 'utf-8'} } - options.merge!(lexer: language.downcase) if Pygments::Lexer.find(language) + lexer = Pygments::Lexer.find(language) # language can be an alias + options.merge!(lexer: lexer.name.downcase) if lexer # downcase is required # New lines are placed to fix an rendering issue # with code wrapped inside

tag for next case: