Only pass first class to Pygments

This prevents an exception if something like the following is used:

~~~ {foo bar}
some code
~~~
This commit is contained in:
Tom Bell 2012-11-13 07:59:36 +00:00
parent a78b587e25
commit 38ac55381b
1 changed files with 1 additions and 1 deletions

View File

@ -15,7 +15,7 @@ module Jekyll
@renderer ||= Class.new(Redcarpet::Render::HTML) do @renderer ||= Class.new(Redcarpet::Render::HTML) do
def block_code(code, lang) def block_code(code, lang)
lang ||= 'text' lang = lang && lang.split.first || "text"
output = add_code_tags( output = add_code_tags(
Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }), Pygments.highlight(code, :lexer => lang, :options => { :encoding => 'utf-8' }),
lang lang