Rubocop: lib/jekyll/converters/markdown.rb
This commit is contained in:
parent
746e360c63
commit
38eb326b7f
|
@ -9,23 +9,33 @@ module Jekyll
|
|||
return if @setup ||= false
|
||||
unless (@parser = get_processor)
|
||||
Jekyll.logger.error "Invalid Markdown processor given:", @config["markdown"]
|
||||
Jekyll.logger.info "", "Custom processors are not loaded in safe mode" if @config["safe"]
|
||||
Jekyll.logger.error "", "Available processors are: #{valid_processors.join(", ")}"
|
||||
if @config["safe"]
|
||||
Jekyll.logger.info "", "Custom processors are not loaded in safe mode"
|
||||
end
|
||||
Jekyll.logger.error(
|
||||
"",
|
||||
"Available processors are: #{valid_processors.join(", ")}"
|
||||
)
|
||||
raise Errors::FatalException, "Bailing out; invalid Markdown processor."
|
||||
end
|
||||
|
||||
@setup = true
|
||||
end
|
||||
|
||||
# Rubocop does not allow reader methods to have names starting with `get_`
|
||||
# To ensure compatibility, this check has been disabled on this method
|
||||
#
|
||||
# rubocop:disable Style/AccessorMethodName
|
||||
def get_processor
|
||||
case @config["markdown"].downcase
|
||||
when "redcarpet" then return RedcarpetParser.new(@config)
|
||||
when "kramdown" then return KramdownParser.new(@config)
|
||||
when "rdiscount" then return RDiscountParser.new(@config)
|
||||
else
|
||||
get_custom_processor
|
||||
custom_processor
|
||||
end
|
||||
end
|
||||
# rubocop:enable Style/AccessorMethodName
|
||||
|
||||
# Public: Provides you with a list of processors, the ones we
|
||||
# support internally and the ones that you have provided to us (if you
|
||||
|
@ -41,13 +51,13 @@ module Jekyll
|
|||
|
||||
def third_party_processors
|
||||
self.class.constants - \
|
||||
%w(KramdownParser RDiscountParser RedcarpetParser PRIORITIES).map(
|
||||
&:to_sym
|
||||
)
|
||||
%w(KramdownParser RDiscountParser RedcarpetParser PRIORITIES).map(
|
||||
&:to_sym
|
||||
)
|
||||
end
|
||||
|
||||
def extname_list
|
||||
@extname_list ||= @config['markdown_ext'].split(',').map do |e|
|
||||
@extname_list ||= @config["markdown_ext"].split(",").map do |e|
|
||||
".#{e.downcase}"
|
||||
end
|
||||
end
|
||||
|
@ -66,7 +76,7 @@ module Jekyll
|
|||
end
|
||||
|
||||
private
|
||||
def get_custom_processor
|
||||
def custom_processor
|
||||
converter_name = @config["markdown"]
|
||||
if custom_class_allowed?(converter_name)
|
||||
self.class.const_get(converter_name).new(@config)
|
||||
|
|
Loading…
Reference in New Issue