diff options
author | Sytse Sijbrandij <sytse@dosire.com> | 2013-06-09 21:30:20 +0200 |
---|---|---|
committer | Sytse Sijbrandij <sytse@dosire.com> | 2013-06-09 21:30:20 +0200 |
commit | 409b0a0ab557dcc146e3123e976a4634f3d05877 (patch) | |
tree | de2ce0c6e02304dfbd9e72d4e85c2d862b36d029 /lib/redcarpet | |
parent | de2c189ec10448787e41e4f2283de7c120fb16df (diff) | |
download | gitlab-ce-409b0a0ab557dcc146e3123e976a4634f3d05877.tar.gz |
Fix pygment lexer 500 errors when an alias is used instead of a name.
Diffstat (limited to 'lib/redcarpet')
-rw-r--r-- | lib/redcarpet/render/gitlab_html.rb | 3 |
1 files changed, 2 insertions, 1 deletions
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 <h1> tag for next case: |