KramdownConverter: clean up some source with some unified methods

This commit is contained in:
Parker Moore 2015-12-04 09:21:11 -08:00
parent e331a37260
commit fe13c3b366
2 changed files with 9 additions and 9 deletions

View File

@ -20,7 +20,7 @@ group :test do
gem 'minitest-profile' gem 'minitest-profile'
gem 'rspec-mocks' gem 'rspec-mocks'
gem 'minitest' gem 'minitest'
gem "nokogiri" gem 'nokogiri'
if RUBY_PLATFORM =~ /cygwin/ || RUBY_VERSION.start_with?("2.2") if RUBY_PLATFORM =~ /cygwin/ || RUBY_VERSION.start_with?("2.2")
gem 'test-unit' gem 'test-unit'

View File

@ -6,12 +6,12 @@ module Jekyll
class Markdown class Markdown
class KramdownParser class KramdownParser
CODERAY_DEFAULTS = { CODERAY_DEFAULTS = {
"css" => "style", "css" => "style",
"bold_every" => 10, "bold_every" => 10,
"line_numbers" => "inline", "line_numbers" => "inline",
"line_number_start" => 1, "line_number_start" => 1,
"tab_width" => 4, "tab_width" => 4,
"wrap" => "div" "wrap" => "div"
} }
def initialize(config) def initialize(config)
@ -47,7 +47,7 @@ module Jekyll
@highlighter ||= begin @highlighter ||= begin
if highlighter = @config["syntax_highlighter"] then highlighter if highlighter = @config["syntax_highlighter"] then highlighter
elsif @config.key?("enable_coderay") && @config["enable_coderay"] elsif @config.key?("enable_coderay") && @config["enable_coderay"]
Jekyll.logger.warn "DEPRECATION: You are using 'enable_coderay', use syntax_highlighter: coderay." Jekyll::Deprecator.deprecation_message "You are using 'enable_coderay', use syntax_highlighter: coderay in your configuration file."
"coderay" "coderay"
else else
@main_fallback_highlighter @main_fallback_highlighter
@ -59,7 +59,7 @@ module Jekyll
def strip_coderay_prefix(hash) def strip_coderay_prefix(hash)
hash.each_with_object({}) do |(key, val), hsh| hash.each_with_object({}) do |(key, val), hsh|
cleaned_key = key.gsub(/\Acoderay_/, "") cleaned_key = key.gsub(/\Acoderay_/, "")
Jekyll.logger.warn "You are using '#{key}'. Normalizing to #{cleaned_key}." if key != cleaned_key Jekyll::Deprecator.deprecation_message "You are using '#{key}'. Normalizing to #{cleaned_key}." if key != cleaned_key
hsh[cleaned_key] = val hsh[cleaned_key] = val
end end
end end
@ -71,7 +71,7 @@ module Jekyll
private private
def modernize_coderay_config def modernize_coderay_config
if highlighter == "coderay" if highlighter == "coderay"
Jekyll.logger.warn "DEPRECATION: kramdown.coderay is deprecated use syntax_highlighter_opts." Jekyll::Deprecator.deprecation_message "You are using 'kramdown.coderay' in your configuration, please use 'syntax_highlighter_opts' instead."
@config["syntax_highlighter_opts"] = begin @config["syntax_highlighter_opts"] = begin
strip_coderay_prefix( strip_coderay_prefix(
@config["syntax_highlighter_opts"] \ @config["syntax_highlighter_opts"] \