Drop support for older versions of Rouge (#6978)

Merge pull request 6978
This commit is contained in:
Ashwin Maroli
2018-05-03 19:33:55 +05:30
committed by jekyllbot
parent acdbf81476
commit f8dfbd2f7b
9 changed files with 10 additions and 73 deletions

View File

@@ -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

View File

@@ -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",

View File

@@ -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"

View File

@@ -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