diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index 7c77f6ba..15354308 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -20,7 +20,7 @@ module Jekyll $2.scan(/(?:\w="[^"]*"|\w=\w|\w)+/) do |opt| key, value = opt.split('=') # If a quoted list, convert to array - if value and value.include? "\"" + if value && value.include?("\"") value.gsub!(/"/, "") value = value.split end diff --git a/test/test_tags.rb b/test/test_tags.rb index 7f2dd4d5..129042dc 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -75,7 +75,13 @@ 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 linenos=table cssclass=hl hl_linenos=3', ["test", "{% endhighlight %}", "\n"]) + assert_equal({ :cssclass => 'hl', :linenos => 'table', :hl_linenos => '3' }, tag.instance_variable_get(:@options)) + + tag = Jekyll::Tags::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl ="3 5 6"', ["test", "{% endhighlight %}", "\n"]) + assert_equal({ :cssclass => 'hl', :linenos => 'table', :hl_linenos => ['3', '5', '6'] }, 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