From 38eb326b7f3d5e847e7a67274e3cc33207c36169 Mon Sep 17 00:00:00 2001 From: Pat Hawks Date: Thu, 26 May 2016 00:53:15 -0500 Subject: [PATCH] Rubocop: lib/jekyll/converters/markdown.rb --- lib/jekyll/converters/markdown.rb | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/lib/jekyll/converters/markdown.rb b/lib/jekyll/converters/markdown.rb index 6e44b3b2..ab886d06 100644 --- a/lib/jekyll/converters/markdown.rb +++ b/lib/jekyll/converters/markdown.rb @@ -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)