parent
							
								
									fce3cbfd81
								
							
						
					
					
						commit
						c14b8b5864
					
				
							
								
								
									
										2
									
								
								Gemfile
								
								
								
								
							
							
						
						
									
										2
									
								
								Gemfile
								
								
								
								
							| 
						 | 
					@ -81,7 +81,7 @@ group :jekyll_optional_dependencies do
 | 
				
			||||||
  platform :ruby, :mswin, :mingw, :x64_mingw do
 | 
					  platform :ruby, :mswin, :mingw, :x64_mingw do
 | 
				
			||||||
    gem "classifier-reborn", "~> 2.1.0"
 | 
					    gem "classifier-reborn", "~> 2.1.0"
 | 
				
			||||||
    gem "liquid-c", "~> 3.0"
 | 
					    gem "liquid-c", "~> 3.0"
 | 
				
			||||||
    gem "pygments.rb", "~> 0.6.0"
 | 
					    gem "pygments.rb", "~> 1.0"
 | 
				
			||||||
    gem "rdiscount", "~> 2.0"
 | 
					    gem "rdiscount", "~> 2.0"
 | 
				
			||||||
    gem "redcarpet", "~> 3.2", ">= 3.2.3"
 | 
					    gem "redcarpet", "~> 3.2", ">= 3.2.3"
 | 
				
			||||||
    gem "yajl-ruby", "~> 1.2"
 | 
					    gem "yajl-ruby", "~> 1.2"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -86,7 +86,7 @@ MSG
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      def render_pygments(code, is_safe)
 | 
					      def render_pygments(code, is_safe)
 | 
				
			||||||
        Jekyll::External.require_with_graceful_fail("pygments")
 | 
					        Jekyll::External.require_with_graceful_fail("pygments") unless defined?(Pygments)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        highlighted_code = Pygments.highlight(
 | 
					        highlighted_code = Pygments.highlight(
 | 
				
			||||||
          code,
 | 
					          code,
 | 
				
			||||||
| 
						 | 
					@ -118,7 +118,7 @@ MSG
 | 
				
			||||||
          :gutter_class => "gutter",
 | 
					          :gutter_class => "gutter",
 | 
				
			||||||
          :code_class   => "code"
 | 
					          :code_class   => "code"
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        lexer = Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
 | 
					        lexer = ::Rouge::Lexer.find_fancy(@lang, code) || Rouge::Lexers::PlainText
 | 
				
			||||||
        formatter.format(lexer.lex(code))
 | 
					        formatter.format(lexer.lex(code))
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -46,16 +46,17 @@ class TestRedcarpet < JekyllUnitTest
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      should "render fenced code blocks with syntax highlighting" do
 | 
					      should "render fenced code blocks with syntax highlighting" do
 | 
				
			||||||
        assert_equal "<div class=\"highlight\"><pre><code class=\"language-ruby\" "\
 | 
					        assert_equal \
 | 
				
			||||||
                     "data-lang=\"ruby\"><span class=\"nb\">puts</span> <span "\
 | 
					          "<div class=\"highlight\"><pre><code class=\"language-ruby\" " \
 | 
				
			||||||
                     "class=\"s2\">"Hello world"</span>\n</code></pre></div>",
 | 
					          "data-lang=\"ruby\"><span></span><span class=\"nb\">puts</span> <span " \
 | 
				
			||||||
                     @markdown.convert(
 | 
					          "class=\"s2\">"Hello world"</span>\n</code></pre></div>",
 | 
				
			||||||
                       <<-EOS
 | 
					          @markdown.convert(
 | 
				
			||||||
 | 
					            <<-EOS
 | 
				
			||||||
```ruby
 | 
					```ruby
 | 
				
			||||||
puts "Hello world"
 | 
					puts "Hello world"
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
EOS
 | 
					EOS
 | 
				
			||||||
                     ).strip
 | 
					          ).strip
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -185,7 +185,8 @@ CONTENT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      should "render markdown with pygments" do
 | 
					      should "render markdown with pygments" do
 | 
				
			||||||
        assert_match(
 | 
					        assert_match(
 | 
				
			||||||
          %(<pre><code class="language-text" data-lang="text">test</code></pre>),
 | 
					          %(<pre><code class="language-text" data-lang="text">) +
 | 
				
			||||||
 | 
					          %(<span></span>test</code></pre>),
 | 
				
			||||||
          @result
 | 
					          @result
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
| 
						 | 
					@ -193,7 +194,7 @@ CONTENT
 | 
				
			||||||
      should "render markdown with pygments with line numbers" do
 | 
					      should "render markdown with pygments with line numbers" do
 | 
				
			||||||
        assert_match(
 | 
					        assert_match(
 | 
				
			||||||
          %(<pre><code class="language-text" data-lang="text">) +
 | 
					          %(<pre><code class="language-text" data-lang="text">) +
 | 
				
			||||||
          %(<span class="lineno">1</span> test</code></pre>),
 | 
					          %(<span></span><span class="lineno">1 </span>test</code></pre>),
 | 
				
			||||||
          @result
 | 
					          @result
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
| 
						 | 
					@ -206,7 +207,7 @@ CONTENT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      should "not embed the file" do
 | 
					      should "not embed the file" do
 | 
				
			||||||
        assert_match(
 | 
					        assert_match(
 | 
				
			||||||
          %(<pre><code class="language-text" data-lang="text">) +
 | 
					          %(<pre><code class="language-text" data-lang="text"><span></span>) +
 | 
				
			||||||
          %(./jekyll.gemspec</code></pre>),
 | 
					          %(./jekyll.gemspec</code></pre>),
 | 
				
			||||||
          @result
 | 
					          @result
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
| 
						 | 
					@ -220,7 +221,8 @@ CONTENT
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      should "render markdown with pygments line handling" do
 | 
					      should "render markdown with pygments line handling" do
 | 
				
			||||||
        assert_match(
 | 
					        assert_match(
 | 
				
			||||||
          %(<pre><code class="language-text" data-lang="text">Æ</code></pre>),
 | 
					          %(<pre><code class="language-text" data-lang="text">) +
 | 
				
			||||||
 | 
					          %(<span></span>Æ</code></pre>),
 | 
				
			||||||
          @result
 | 
					          @result
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
| 
						 | 
					@ -240,7 +242,8 @@ EOS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      should "only strip the preceding newlines" do
 | 
					      should "only strip the preceding newlines" do
 | 
				
			||||||
        assert_match(
 | 
					        assert_match(
 | 
				
			||||||
          %(<pre><code class=\"language-text\" data-lang=\"text\">     [,1] [,2]),
 | 
					          %(<pre><code class=\"language-text\" data-lang=\"text\">) +
 | 
				
			||||||
 | 
					          %(<span></span>     [,1] [,2]),
 | 
				
			||||||
          @result
 | 
					          @result
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
| 
						 | 
					@ -265,8 +268,8 @@ EOS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      should "only strip the newlines which precede and succeed the entire block" do
 | 
					      should "only strip the newlines which precede and succeed the entire block" do
 | 
				
			||||||
        assert_match(
 | 
					        assert_match(
 | 
				
			||||||
          "<pre><code class=\"language-text\" data-lang=\"text\">" \
 | 
					          %(<pre><code class=\"language-text\" data-lang=\"text\"><span></span>) +
 | 
				
			||||||
          "     [,1] [,2]\n\n\n[1,] FALSE TRUE\n[2,] FALSE TRUE</code></pre>",
 | 
					          %(     [,1] [,2]\n\n\n[1,] FALSE TRUE\n[2,] FALSE TRUE</code></pre>),
 | 
				
			||||||
          @result
 | 
					          @result
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
| 
						 | 
					@ -280,7 +283,8 @@ EOS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      should "only strip the preceding newlines" do
 | 
					      should "only strip the preceding newlines" do
 | 
				
			||||||
        assert_match(
 | 
					        assert_match(
 | 
				
			||||||
          %(<pre><code class="language-text" data-lang="text">     [,1] [,2]),
 | 
					          %(<pre><code class="language-text" data-lang="text"><span></span>) +
 | 
				
			||||||
 | 
					          %(     [,1] [,2]),
 | 
				
			||||||
          @result
 | 
					          @result
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
| 
						 | 
					@ -298,7 +302,8 @@ EOS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      should "only strip the preceding newlines" do
 | 
					      should "only strip the preceding newlines" do
 | 
				
			||||||
        assert_match(
 | 
					        assert_match(
 | 
				
			||||||
          %(<pre><code class=\"language-text\" data-lang=\"text\">     [,1] [,2]),
 | 
					          %(<pre><code class=\"language-text\" data-lang=\"text\"><span></span>) +
 | 
				
			||||||
 | 
					          %(     [,1] [,2]),
 | 
				
			||||||
          @result
 | 
					          @result
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue