From d250efccb91fcf8774a779d0c3aee40715a47353 Mon Sep 17 00:00:00 2001 From: Brandon Bradley Date: Mon, 24 Nov 2014 19:56:26 -0600 Subject: [PATCH 1/2] add test for broken markdown regexp --- test/source/_posts/2014-11-24-Rmd-extension.Rmd | 0 test/test_generated_site.rb | 2 +- test/test_post.rb | 7 +++++++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 test/source/_posts/2014-11-24-Rmd-extension.Rmd diff --git a/test/source/_posts/2014-11-24-Rmd-extension.Rmd b/test/source/_posts/2014-11-24-Rmd-extension.Rmd new file mode 100644 index 00000000..e69de29b diff --git a/test/test_generated_site.rb b/test/test_generated_site.rb index 37818726..0b157e85 100644 --- a/test/test_generated_site.rb +++ b/test/test_generated_site.rb @@ -14,7 +14,7 @@ class TestGeneratedSite < Test::Unit::TestCase end should "ensure post count is as expected" do - assert_equal 43, @site.posts.size + assert_equal 44, @site.posts.size end should "insert site.posts into the index" do diff --git a/test/test_post.rb b/test/test_post.rb index 582d100a..65eaaf92 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -677,6 +677,13 @@ class TestPost < Test::Unit::TestCase assert conv.kind_of? Jekyll::Converters::Identity end + should "process .Rmd under text if it is not in the markdown config" do + @site.config['markdown_ext'] = 'markdown,mkd,md,text' + post = setup_post '2014-11-24-Rmd-extension.Rmd' + conv = post.converters.first + assert conv.kind_of? Jekyll::Converters::Identity + end + should "process .text as textile under alternate configuration" do @site.config['textile_ext'] = 'textile,text' post = setup_post '2011-04-12-text-extension.text' From e546eb3e9fbb194679e856043c52a704c4886c6a Mon Sep 17 00:00:00 2001 From: Brandon Bradley Date: Mon, 24 Nov 2014 20:08:31 -0600 Subject: [PATCH 2/2] force markdown regexp to match the full extension --- lib/jekyll/converters/markdown.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/converters/markdown.rb b/lib/jekyll/converters/markdown.rb index 0dcc90a8..f0d1afb0 100644 --- a/lib/jekyll/converters/markdown.rb +++ b/lib/jekyll/converters/markdown.rb @@ -48,7 +48,7 @@ module Jekyll def extname_matches_regexp @extname_matches_regexp ||= Regexp.new( - '(' + @config['markdown_ext'].gsub(',','|') +')$', + '^\.(' + @config['markdown_ext'].gsub(',','|') +')$', Regexp::IGNORECASE ) end