diff --git a/.travis.yml b/.travis.yml index 2f6066a8..2aa960d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,8 +16,6 @@ matrix: env: TEST_SUITE=fmt - rvm: *ruby1 env: TEST_SUITE=default-site - - rvm: *ruby1 - env: ROUGE_VERSION=1.11.1 # runs everything with this version exclude: - rvm: *jruby env: TEST_SUITE=cucumber diff --git a/Gemfile b/Gemfile index a4777c71..88a4e5bd 100644 --- a/Gemfile +++ b/Gemfile @@ -5,8 +5,6 @@ gemspec :name => "jekyll" gem "rake", "~> 12.0" -gem "rouge", ENV["ROUGE"] if ENV["ROUGE"] - group :development do gem "launchy", "~> 2.3" gem "pry" diff --git a/jekyll.gemspec b/jekyll.gemspec index 35eea7a9..107fe7c3 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -40,7 +40,6 @@ Gem::Specification.new do |s| s.add_runtime_dependency("liquid", "~> 4.0") s.add_runtime_dependency("mercenary", "~> 0.3.3") s.add_runtime_dependency("pathutil", "~> 0.9") - rouge_versions = ENV["ROUGE_VERSION"] ? ["~> #{ENV["ROUGE_VERSION"]}"] : [">= 1.7", "< 4"] - s.add_runtime_dependency("rouge", *rouge_versions) + s.add_runtime_dependency("rouge", "~> 3.0") s.add_runtime_dependency("safe_yaml", "~> 1.0") end diff --git a/lib/jekyll/converters/markdown/redcarpet_parser.rb b/lib/jekyll/converters/markdown/redcarpet_parser.rb index d148e06d..d9383b7b 100644 --- a/lib/jekyll/converters/markdown/redcarpet_parser.rb +++ b/lib/jekyll/converters/markdown/redcarpet_parser.rb @@ -57,7 +57,8 @@ class Jekyll::Converters::Markdown::RedcarpetParser protected def rouge_formatter(_lexer) - Jekyll::Utils::Rouge.html_formatter(:wrap => false) + require "rouge" + ::Rouge::Formatters::HTMLLegacy.new(:wrap => false) end end diff --git a/lib/jekyll/tags/highlight.rb b/lib/jekyll/tags/highlight.rb index 37fbec2c..e2ef3adb 100644 --- a/lib/jekyll/tags/highlight.rb +++ b/lib/jekyll/tags/highlight.rb @@ -112,7 +112,8 @@ MSG end def render_rouge(code) - formatter = Jekyll::Utils::Rouge.html_formatter( + require "rouge" + formatter = ::Rouge::Formatters::HTMLLegacy.new( :line_numbers => @highlight_options[:linenos], :wrap => false, :css_class => "highlight", diff --git a/lib/jekyll/utils.rb b/lib/jekyll/utils.rb index 742a862c..e17a4cdc 100644 --- a/lib/jekyll/utils.rb +++ b/lib/jekyll/utils.rb @@ -7,7 +7,6 @@ module Jekyll autoload :Exec, "jekyll/utils/exec" autoload :Internet, "jekyll/utils/internet" autoload :Platforms, "jekyll/utils/platforms" - autoload :Rouge, "jekyll/utils/rouge" autoload :ThreadEvent, "jekyll/utils/thread_event" autoload :WinTZ, "jekyll/utils/win_tz" diff --git a/lib/jekyll/utils/rouge.rb b/lib/jekyll/utils/rouge.rb deleted file mode 100644 index 9afc689f..00000000 --- a/lib/jekyll/utils/rouge.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -Jekyll::External.require_with_graceful_fail("rouge") - -module Jekyll - module Utils - module Rouge - - def self.html_formatter(*args) - if old_api? - ::Rouge::Formatters::HTML.new(*args) - else - ::Rouge::Formatters::HTMLLegacy.new(*args) - end - end - - def self.old_api? - ::Rouge.version.to_s < "2" - end - end - end -end diff --git a/test/test_kramdown.rb b/test/test_kramdown.rb index f68bb17c..db5c853b 100644 --- a/test/test_kramdown.rb +++ b/test/test_kramdown.rb @@ -20,7 +20,7 @@ class TestKramdown < JekyllUnitTest "bold_every" => 8, "css" => :class, "css_class" => "highlight", - "formatter" => Jekyll::Utils::Rouge.html_formatter.class, + "formatter" => Rouge::Formatters::HTMLLegacy, }, }, } @@ -91,8 +91,7 @@ class TestKramdown < JekyllUnitTest puts "Hello World" ~~~ MARKDOWN - div_highlight = "" - div_highlight = ">div.highlight" unless Utils::Rouge.old_api? + div_highlight = ">div.highlight" selector = "div.highlighter-rouge#{div_highlight}>pre.highlight>code" refute result.css(selector).empty? end diff --git a/test/test_tags.rb b/test/test_tags.rb index e7a0f726..ee01a596 100644 --- a/test/test_tags.rb +++ b/test/test_tags.rb @@ -323,8 +323,7 @@ EOS ) end - should "render markdown with rouge 2 with line numbers" do - skip "Skipped because using an older version of Rouge" if Utils::Rouge.old_api? + should "render markdown with rouge with line numbers" do assert_match( %() + %(
) + @@ -334,18 +333,6 @@ EOS @result ) end - - should "render markdown with rouge 1 with line numbers" do - skip "Skipped because using a newer version of Rouge" unless Utils::Rouge.old_api? - assert_match( - %() + - %() + - %() + - %(
) + - %(
1
test\n
), - @result - ) - end end context "post content has raw tag" do @@ -364,18 +351,7 @@ CONTENT create_post(content) end - should "render markdown with rouge 1" do - skip "Skipped because using a newer version of Rouge" unless Utils::Rouge.old_api? - - assert_match( - %(
),
-          @result
-        )
-      end
-
-      should "render markdown with rouge 2" do
-        skip "Skipped because using an older version of Rouge" if Utils::Rouge.old_api?
-
+      should "render markdown with rouge" do
         assert_match(
           %(
) + %(
),
@@ -471,24 +447,12 @@ This should not be highlighted, right?
 EOS
       end
 
-      should "should stop highlighting at boundary with rouge 2" do
-        skip "Skipped because using an older version of Rouge" if Utils::Rouge.old_api?
+      should "should stop highlighting at boundary with rouge" do
         expected = <<-EOS
 

This is not yet highlighted

\n
1
 
test
\n

This should not be highlighted, right?

-EOS - assert_match(expected, @result) - end - - should "should stop highlighting at boundary with rouge 1" do - skip "Skipped because using a newer version of Rouge" unless Utils::Rouge.old_api? - expected = <<-EOS -

This is not yet highlighted

\n -
1
test
-
\n -

This should not be highlighted, right?

EOS assert_match(expected, @result) end