Merge pull request #1382 from torsneyt/fix_md_ext

Markdown extension matching matches only exact matches
This commit is contained in:
Parker Moore 2013-08-06 09:47:33 -07:00
commit ae218dd0db
4 changed files with 9 additions and 2 deletions

View File

@ -26,7 +26,7 @@ module Jekyll
end end
def matches(ext) def matches(ext)
rgx = '(' + @config['markdown_ext'].gsub(',','|') +')' rgx = '^\.(' + @config['markdown_ext'].gsub(',','|') +')$'
ext =~ Regexp.new(rgx, Regexp::IGNORECASE) ext =~ Regexp.new(rgx, Regexp::IGNORECASE)
end end

View File

@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase
end end
should "ensure post count is as expected" do should "ensure post count is as expected" do
assert_equal 35, @site.posts.size assert_equal 36, @site.posts.size
end end
should "insert site.posts into the index" do should "insert site.posts into the index" do

View File

@ -562,6 +562,13 @@ class TestPost < Test::Unit::TestCase
assert conv.kind_of? Jekyll::Converters::Markdown assert conv.kind_of? Jekyll::Converters::Markdown
end end
should "process .mkdn under text if it is not in the markdown config" do
@site.config['markdown_ext'] = 'markdown,mkd,md,text'
post = setup_post '2013-08-01-mkdn-extension.mkdn'
conv = post.converter
assert conv.kind_of? Jekyll::Converters::Identity
end
should "process .text as textile under alternate configuration" do should "process .text as textile under alternate configuration" do
@site.config['textile_ext'] = 'textile,text' @site.config['textile_ext'] = 'textile,text'
post = setup_post '2011-04-12-text-extension.text' post = setup_post '2011-04-12-text-extension.text'