Markdown#matches should avoid regexp

This commit is contained in:
Parker Moore 2015-01-17 16:25:10 -08:00
parent f7271a6ef9
commit ef2d558874
1 changed files with 3 additions and 6 deletions

View File

@ -46,15 +46,12 @@ module Jekyll
].map(&:to_sym) ].map(&:to_sym)
end end
def extname_matches_regexp def extname_list
@extname_matches_regexp ||= Regexp.new( @extname_list ||= @config['markdown_ext'].split(',').map { |e| ".#{e.downcase}" }
'^\.(' + @config['markdown_ext'].gsub(',','|') +')$',
Regexp::IGNORECASE
)
end end
def matches(ext) def matches(ext)
ext =~ extname_matches_regexp extname_list.include? ext.downcase
end end
def output_ext(ext) def output_ext(ext)