parent
7f2412c145
commit
18f7a28168
|
@ -13,21 +13,22 @@ module Jekyll
|
||||||
return if @setup ||= false
|
return if @setup ||= false
|
||||||
|
|
||||||
unless (@parser = get_processor)
|
unless (@parser = get_processor)
|
||||||
Jekyll.logger.error "Invalid Markdown processor given:", @config["markdown"]
|
if @config["safe"]
|
||||||
Jekyll.logger.info "", "Custom processors are not loaded in safe mode" if @config["safe"]
|
Jekyll.logger.warn "Build Warning:", "Custom processors are not loaded in safe mode"
|
||||||
Jekyll.logger.error(
|
end
|
||||||
"",
|
|
||||||
"Available processors are: #{valid_processors.join(", ")}"
|
Jekyll.logger.error "Markdown processor:",
|
||||||
)
|
"#{@config["markdown"].inspect} is not a valid Markdown processor."
|
||||||
raise Errors::FatalException, "Bailing out; invalid Markdown processor."
|
Jekyll.logger.error "", "Available processors are: #{valid_processors.join(", ")}"
|
||||||
|
Jekyll.logger.error ""
|
||||||
|
raise Errors::FatalException, "Invalid Markdown processor given: #{@config["markdown"]}"
|
||||||
end
|
end
|
||||||
|
|
||||||
@cache = Jekyll::Cache.new("Jekyll::Converters::Markdown")
|
@cache = Jekyll::Cache.new("Jekyll::Converters::Markdown")
|
||||||
|
|
||||||
@setup = true
|
@setup = true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Rubocop does not allow reader methods to have names starting with `get_`
|
# RuboCop does not allow reader methods to have names starting with `get_`
|
||||||
# To ensure compatibility, this check has been disabled on this method
|
# To ensure compatibility, this check has been disabled on this method
|
||||||
#
|
#
|
||||||
# rubocop:disable Naming/AccessorMethodName
|
# rubocop:disable Naming/AccessorMethodName
|
||||||
|
@ -40,29 +41,19 @@ module Jekyll
|
||||||
end
|
end
|
||||||
# rubocop:enable Naming/AccessorMethodName
|
# rubocop:enable Naming/AccessorMethodName
|
||||||
|
|
||||||
# Public: Provides you with a list of processors, the ones we
|
# Public: Provides you with a list of processors comprised of the ones we support internally
|
||||||
# support internally and the ones that you have provided to us (if you
|
# and the ones that you have provided to us (if they're whitelisted for use in safe mode).
|
||||||
# are not in safe mode.)
|
#
|
||||||
|
# Returns an array of symbols.
|
||||||
def valid_processors
|
def valid_processors
|
||||||
%w(kramdown) + third_party_processors
|
[:kramdown] + third_party_processors
|
||||||
end
|
end
|
||||||
|
|
||||||
# Public: A list of processors that you provide via plugins.
|
# Public: A list of processors that you provide via plugins.
|
||||||
# This is really only available if you are not in safe mode, if you are
|
#
|
||||||
# in safe mode (re: GitHub) then there will be none.
|
# Returns an array of symbols
|
||||||
|
|
||||||
def third_party_processors
|
def third_party_processors
|
||||||
self.class.constants - \
|
self.class.constants - [:KramdownParser, :PRIORITIES]
|
||||||
%w(KramdownParser PRIORITIES).map(
|
|
||||||
&:to_sym
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
def extname_list
|
|
||||||
@extname_list ||= @config["markdown_ext"].split(",").map do |e|
|
|
||||||
".#{e.downcase}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Does the given extension match this converter's list of acceptable extensions?
|
# Does the given extension match this converter's list of acceptable extensions?
|
||||||
|
@ -96,6 +87,10 @@ module Jekyll
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def extname_list
|
||||||
|
@extname_list ||= @config["markdown_ext"].split(",").map! { |e| ".#{e.downcase}" }
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def custom_processor
|
def custom_processor
|
||||||
|
@ -108,12 +103,10 @@ module Jekyll
|
||||||
#
|
#
|
||||||
# parser_name - the name of the parser class
|
# parser_name - the name of the parser class
|
||||||
#
|
#
|
||||||
# Returns true if the parser name contains only alphanumeric
|
# Returns true if the parser name contains only alphanumeric characters and is defined
|
||||||
# characters and is defined within Jekyll::Converters::Markdown
|
# within Jekyll::Converters::Markdown
|
||||||
def custom_class_allowed?(parser_name)
|
def custom_class_allowed?(parser_name)
|
||||||
parser_name !~ %r![^A-Za-z0-9_]! && self.class.constants.include?(
|
parser_name !~ %r![^A-Za-z0-9_]! && self.class.constants.include?(parser_name.to_sym)
|
||||||
parser_name.to_sym
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue