From 60b43104ee9ae0c59330f55c4dc08a27fabce2d0 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Thu, 26 Dec 2013 00:02:56 -0500 Subject: [PATCH] Extract checks for acceptable custom markdown processors to method. We should probably write more about what it does and how it works in a TomDoc block above. @envygeeks, want to give that a shot? --- lib/jekyll/converters/markdown.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/converters/markdown.rb b/lib/jekyll/converters/markdown.rb index 837a757d..878be0b8 100644 --- a/lib/jekyll/converters/markdown.rb +++ b/lib/jekyll/converters/markdown.rb @@ -16,7 +16,7 @@ module Jekyll when 'maruku' then MarukuParser.new(@config) else # So they can't try some tricky bullshit or go down the ancestor chain, I hope. - if @config['markdown'] !~ /[^A-Za-z0-9]/ && self.class.constants.include?(@config['markdown'].to_sym) + if allowed_custom_class?(@config['markdown']) self.class.const_get(@config['markdown']).new(@config) else Jekyll.logger.error "Invalid Markdown Processor:", "#{@config['markdown']}" @@ -40,6 +40,11 @@ module Jekyll setup @parser.convert(content) end + + private + def allowed_custom_class?(parser_name) + parser_name !~ /[^A-Za-z0-9]/ && self.class.constants.include?(parser_name.to_sym) + end end end end