summaryrefslogtreecommitdiff
path: root/lib/redcarpet/render
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2013-07-07 19:00:07 +0200
committerRobert Schilling <rschilling@student.tugraz.at>2013-07-07 19:00:07 +0200
commitdb325ef940e7c084d3a9daf0a5efec2b2580004b (patch)
tree9333ffdeae2c7dbd12dbc14277f6d47fbd58d692 /lib/redcarpet/render
parentc04e9733273e24b831cdbd44c9cc4057f7380578 (diff)
downloadgitlab-ce-db325ef940e7c084d3a9daf0a5efec2b2580004b.tar.gz
Fix Pygments 500 error if lexer not found by name. Use first alias instead. fixes #4473, #4451
Diffstat (limited to 'lib/redcarpet/render')
-rw-r--r--lib/redcarpet/render/gitlab_html.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/redcarpet/render/gitlab_html.rb b/lib/redcarpet/render/gitlab_html.rb
index 318adbf1894..d9c2d3b626d 100644
--- a/lib/redcarpet/render/gitlab_html.rb
+++ b/lib/redcarpet/render/gitlab_html.rb
@@ -12,7 +12,7 @@ class Redcarpet::Render::GitlabHTML < Redcarpet::Render::HTML
def block_code(code, language)
options = { options: {encoding: 'utf-8'} }
lexer = Pygments::Lexer.find(language) # language can be an alias
- options.merge!(lexer: lexer.name.downcase) if lexer # downcase is required
+ options.merge!(lexer: lexer.aliases[0].downcase) if lexer # downcase is required
# New lines are placed to fix an rendering issue
# with code wrapped inside <h1> tag for next case: