Merge pull request #616 from hokaccha/fix_pygments_opt
fixed pygments linenos options for pygments.rb
This commit is contained in:
		
						commit
						a05b9159d9
					
				| 
						 | 
				
			
			@ -15,8 +15,8 @@ module Jekyll
 | 
			
		|||
      super
 | 
			
		||||
      if markup.strip =~ SYNTAX
 | 
			
		||||
        @lang = $1
 | 
			
		||||
        @options = {}
 | 
			
		||||
        if defined?($2) && $2 != ''
 | 
			
		||||
          tmp_options = {}
 | 
			
		||||
          $2.split.each do |opt|
 | 
			
		||||
            key, value = opt.split('=')
 | 
			
		||||
            if value.nil?
 | 
			
		||||
| 
						 | 
				
			
			@ -26,13 +26,8 @@ module Jekyll
 | 
			
		|||
                value = true
 | 
			
		||||
              end
 | 
			
		||||
            end
 | 
			
		||||
            tmp_options[key] = value
 | 
			
		||||
            @options[key] = value
 | 
			
		||||
          end
 | 
			
		||||
          tmp_options = tmp_options.to_a.sort.collect { |opt| opt.join('=') }
 | 
			
		||||
          # additional options to pass to Albino
 | 
			
		||||
          @options = { 'O' => tmp_options.join(',') }
 | 
			
		||||
        else
 | 
			
		||||
          @options = {}
 | 
			
		||||
        end
 | 
			
		||||
      else
 | 
			
		||||
        raise SyntaxError.new("Syntax Error in 'highlight' - Valid syntax: highlight <lang> [linenos]")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -58,16 +58,16 @@ CONTENT
 | 
			
		|||
      assert_equal({}, tag.instance_variable_get(:@options))
 | 
			
		||||
 | 
			
		||||
      tag = Jekyll::HighlightBlock.new('highlight', 'ruby linenos ', ["test", "{% endhighlight %}", "\n"])
 | 
			
		||||
      assert_equal({'O' => "linenos=inline"}, tag.instance_variable_get(:@options))
 | 
			
		||||
      assert_equal({ 'linenos' => 'inline' }, tag.instance_variable_get(:@options))
 | 
			
		||||
 | 
			
		||||
      tag = Jekyll::HighlightBlock.new('highlight', 'ruby linenos=table ', ["test", "{% endhighlight %}", "\n"])
 | 
			
		||||
      assert_equal({'O' => "linenos=table"}, tag.instance_variable_get(:@options))
 | 
			
		||||
      assert_equal({ 'linenos' => 'table' }, tag.instance_variable_get(:@options))
 | 
			
		||||
 | 
			
		||||
      tag = Jekyll::HighlightBlock.new('highlight', 'ruby linenos=table nowrap', ["test", "{% endhighlight %}", "\n"])
 | 
			
		||||
      assert_equal({'O' => "linenos=table,nowrap=true"}, tag.instance_variable_get(:@options))
 | 
			
		||||
      assert_equal({ 'linenos' => 'table', 'nowrap' => true }, tag.instance_variable_get(:@options))
 | 
			
		||||
 | 
			
		||||
      tag = Jekyll::HighlightBlock.new('highlight', 'ruby linenos=table cssclass=hl', ["test", "{% endhighlight %}", "\n"])
 | 
			
		||||
      assert_equal({'O' => "cssclass=hl,linenos=table"}, tag.instance_variable_get(:@options))
 | 
			
		||||
      assert_equal({ 'cssclass' => 'hl', 'linenos' => 'table' }, tag.instance_variable_get(:@options))
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue