diff --git a/Gemfile b/Gemfile index 2ba32da7..8590544e 100644 --- a/Gemfile +++ b/Gemfile @@ -81,7 +81,7 @@ group :jekyll_optional_dependencies do platform :ruby, :mswin, :mingw, :x64_mingw do gem "classifier-reborn", "~> 2.1.0" gem "liquid-c", "~> 3.0" - gem "pygments.rb", "~> 0.6.0" + gem "pygments.rb", "~> 1.0" gem "rdiscount", "~> 2.0" gem "redcarpet", "~> 3.2", ">= 3.2.3" gem "yajl-ruby", "~> 1.2" diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index 683e3b2b..256342c3 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -86,7 +86,7 @@ MSG end 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( code, @@ -118,7 +118,7 @@ MSG :gutter_class => "gutter", :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)) end diff --git a/test/test_redcarpet.rb b/test/test_redcarpet.rb index f4208570..29d787ae 100644 --- a/test/test_redcarpet.rb +++ b/test/test_redcarpet.rb @@ -46,16 +46,17 @@ class TestRedcarpet < JekyllUnitTest end should "render fenced code blocks with syntax highlighting" do - assert_equal "
puts "Hello world"\n
puts "Hello world"\n
test
),
+ %() +
+ %(test
),
@result
)
end
@@ -193,7 +194,7 @@ CONTENT
should "render markdown with pygments with line numbers" do
assert_match(
%() +
- %(1 test
),
+ %(1 test),
@result
)
end
@@ -206,7 +207,7 @@ CONTENT
should "not embed the file" do
assert_match(
- %() +
+ %() +
%(./jekyll.gemspec
),
@result
)
@@ -220,7 +221,8 @@ CONTENT
should "render markdown with pygments line handling" do
assert_match(
- %(Æ
),
+ %() +
+ %(Æ
),
@result
)
end
@@ -240,7 +242,8 @@ EOS
should "only strip the preceding newlines" do
assert_match(
- %( [,1] [,2]),
+ %() +
+ %( [,1] [,2]),
@result
)
end
@@ -265,8 +268,8 @@ EOS
should "only strip the newlines which precede and succeed the entire block" do
assert_match(
- "" \
- " [,1] [,2]\n\n\n[1,] FALSE TRUE\n[2,] FALSE TRUE
",
+ %() +
+ %( [,1] [,2]\n\n\n[1,] FALSE TRUE\n[2,] FALSE TRUE
),
@result
)
end
@@ -280,7 +283,8 @@ EOS
should "only strip the preceding newlines" do
assert_match(
- %( [,1] [,2]),
+ %() +
+ %( [,1] [,2]),
@result
)
end
@@ -298,7 +302,8 @@ EOS
should "only strip the preceding newlines" do
assert_match(
- %( [,1] [,2]),
+ %() +
+ %( [,1] [,2]),
@result
)
end