From d5f137bc867b0801538403241bf8544689ee614a Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sat, 5 Oct 2013 11:26:26 -0400 Subject: [PATCH 1/3] downcase lexers before passing to Pygments --- 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 e8059edb..687ef8c8 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -13,7 +13,7 @@ module Jekyll def initialize(tag_name, markup, tokens) super - if markup.strip =~ SYNTAX + if markup.downcase.strip =~ SYNTAX @lang = $1 @options = {} if defined?($2) && $2 != '' From 844cc615e4631902c9508381e2988047048b906c Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sun, 6 Oct 2013 15:55:16 -0400 Subject: [PATCH 2/3] actually downcase lexer --- lib/jekyll/tags/highlight.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index 687ef8c8..2ea144df 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -13,8 +13,8 @@ module Jekyll def initialize(tag_name, markup, tokens) super - if markup.downcase.strip =~ SYNTAX - @lang = $1 + if markup.strip =~ SYNTAX + @lang = $1.downcase @options = {} if defined?($2) && $2 != '' $2.split.each do |opt| From 9b0a7b3438fbd5efd0704100e1db31932c901098 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Sun, 6 Oct 2013 16:06:20 -0400 Subject: [PATCH 3/3] test for lexer case insensitivity --- test/test_tags.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/test_tags.rb b/test/test_tags.rb index fe16faa5..135bdd10 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -69,6 +69,9 @@ CONTENT tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl', ["test", "{% endhighlight %}", "\n"]) assert_equal({ 'cssclass' => 'hl', 'linenos' => 'table' }, tag.instance_variable_get(:@options)) + + tag = Jekyll::Tags::HighlightBlock.new('highlight', 'Ruby ', ["test", "{% endhighlight %}", "\n"]) + assert_equal "ruby", tag.instance_variable_get(:@lang), "lexers should be case insensitive" end end