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?
This commit is contained in:
parent
a206dc1a8f
commit
60b43104ee
|
@ -16,7 +16,7 @@ module Jekyll
|
||||||
when 'maruku' then MarukuParser.new(@config)
|
when 'maruku' then MarukuParser.new(@config)
|
||||||
else
|
else
|
||||||
# So they can't try some tricky bullshit or go down the ancestor chain, I hope.
|
# 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)
|
self.class.const_get(@config['markdown']).new(@config)
|
||||||
else
|
else
|
||||||
Jekyll.logger.error "Invalid Markdown Processor:", "#{@config['markdown']}"
|
Jekyll.logger.error "Invalid Markdown Processor:", "#{@config['markdown']}"
|
||||||
|
@ -40,6 +40,11 @@ module Jekyll
|
||||||
setup
|
setup
|
||||||
@parser.convert(content)
|
@parser.convert(content)
|
||||||
end
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue