parent
							
								
									664b20d375
								
							
						
					
					
						commit
						61e53b6b61
					
				| 
						 | 
					@ -19,6 +19,13 @@ class TestRedcarpet < JekyllUnitTest
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      @markdown = Converters::Markdown.new @config
 | 
					      @markdown = Converters::Markdown.new @config
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      @sample = Jekyll::Utils.strip_heredoc(<<-EOS
 | 
				
			||||||
 | 
					        ```ruby
 | 
				
			||||||
 | 
					        puts "Hello world"
 | 
				
			||||||
 | 
					        ```
 | 
				
			||||||
 | 
					      EOS
 | 
				
			||||||
 | 
					                                           )
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    should "pass redcarpet options" do
 | 
					    should "pass redcarpet options" do
 | 
				
			||||||
| 
						 | 
					@ -35,7 +42,7 @@ class TestRedcarpet < JekyllUnitTest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    should "pass redcarpet render options" do
 | 
					    should "pass redcarpet render options" do
 | 
				
			||||||
      assert_equal "<p><strong>bad code not here</strong>: i am bad</p>",
 | 
					      assert_equal "<p><strong>bad code not here</strong>: i am bad</p>",
 | 
				
			||||||
              @markdown.convert("**bad code not here**: <script>i am bad</script>").strip
 | 
					        @markdown.convert("**bad code not here**: <script>i am bad</script>").strip
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    context "with pygments enabled" do
 | 
					    context "with pygments enabled" do
 | 
				
			||||||
| 
						 | 
					@ -46,17 +53,12 @@ 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 \
 | 
					        assert_equal(
 | 
				
			||||||
          "<div class=\"highlight\"><pre><code class=\"language-ruby\" " \
 | 
					          %(<div class="highlight"><pre><code class="language-ruby" ) +
 | 
				
			||||||
          "data-lang=\"ruby\"><span></span><span class=\"nb\">puts</span> <span " \
 | 
					          %(data-lang="ruby"><span></span><span class="nb">puts</span> <span ) +
 | 
				
			||||||
          "class=\"s2\">"Hello world"</span>\n</code></pre></div>",
 | 
					          %(class="s2">"Hello world"</span>\n</code></pre></div>),
 | 
				
			||||||
          @markdown.convert(
 | 
					          @markdown.convert(@sample).strip
 | 
				
			||||||
            <<-EOS
 | 
					        )
 | 
				
			||||||
```ruby
 | 
					 | 
				
			||||||
puts "Hello world"
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
EOS
 | 
					 | 
				
			||||||
          ).strip
 | 
					 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -66,16 +68,12 @@ EOS
 | 
				
			||||||
      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 class="nb">puts</span> <span ) +
 | 
				
			||||||
                     @markdown.convert(
 | 
					          %(class="s2">"Hello world"</span>\n</code></pre></div>),
 | 
				
			||||||
                       <<-EOS
 | 
					          @markdown.convert(@sample).strip
 | 
				
			||||||
```ruby
 | 
					        )
 | 
				
			||||||
puts "Hello world"
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
          EOS
 | 
					 | 
				
			||||||
                     ).strip
 | 
					 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -85,16 +83,11 @@ puts "Hello world"
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      should "render fenced code blocks without syntax highlighting" do
 | 
					      should "render fenced code blocks without syntax highlighting" do
 | 
				
			||||||
        assert_equal "<figure class=\"highlight\"><pre><code class=\"language-ruby\" "\
 | 
					        assert_equal(
 | 
				
			||||||
                     "data-lang=\"ruby\">puts "Hello world"\n</code></pre>"\
 | 
					          %(<figure class="highlight"><pre><code class="language-ruby" ) +
 | 
				
			||||||
                     "</figure>",
 | 
					          %(data-lang="ruby">puts "Hello world"\n</code></pre></figure>),
 | 
				
			||||||
                     @markdown.convert(
 | 
					          @markdown.convert(@sample).strip
 | 
				
			||||||
                       <<-EOS
 | 
					        )
 | 
				
			||||||
```ruby
 | 
					 | 
				
			||||||
puts "Hello world"
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
          EOS
 | 
					 | 
				
			||||||
                     ).strip
 | 
					 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
  end
 | 
					  end
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue