From a38902b5a737a497906741d2f026db7874a142d0 Mon Sep 17 00:00:00 2001 From: Stephen McDonald Date: Tue, 23 Apr 2013 06:48:31 +1000 Subject: [PATCH 1/2] Use valid css class names when pygments language contains invalid chars, eg html+jango --- lib/jekyll/tags/highlight.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index c84ea111..bfba8912 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -53,7 +53,7 @@ eos output = add_code_tags( Pygments.highlight(code, :lexer => @lang, :options => @options), - @lang + @lang.gsub("+", "-") ) output = context["pygments_prefix"] + output if context["pygments_prefix"] From de9ce3437da276abf107e7b069998102b53b3b04 Mon Sep 17 00:00:00 2001 From: Stephen McDonald Date: Tue, 18 Mar 2014 08:41:49 +1100 Subject: [PATCH 2/2] Protect against nil @lang before fixing for css class names. --- lib/jekyll/tags/highlight.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index bfba8912..770bd932 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -53,7 +53,7 @@ eos output = add_code_tags( Pygments.highlight(code, :lexer => @lang, :options => @options), - @lang.gsub("+", "-") + @lang.to_s.gsub("+", "-") ) output = context["pygments_prefix"] + output if context["pygments_prefix"]