From 7012598d8ea284ac34f8c28120598be3e7fbd2d7 Mon Sep 17 00:00:00 2001 From: Paul Chaignon Date: Thu, 7 Aug 2014 16:32:17 +0200 Subject: [PATCH 1/3] Render RMarkdown (.rmd) as Markdown --- lib/github/markup/markdown.rb | 2 +- test/markup_test.rb | 1 + test/markups/README.rmd | 3 +++ test/markups/README.rmd.html | 6 ++++++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 test/markups/README.rmd create mode 100644 test/markups/README.rmd.html diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index f4ef99dc..07f7ff87 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -25,7 +25,7 @@ class Markdown < Implementation } def initialize - super(/md|mkdn?|mdwn|mdown|markdown|litcoffee/) + super(/md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/) end def load diff --git a/test/markup_test.rb b/test/markup_test.rb index b9070b1a..cc7f74bf 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -35,6 +35,7 @@ class MarkupTest < Test::Unit::TestCase def test_knows_what_it_can_and_cannot_render assert_equal false, GitHub::Markup.can_render?('README.html') assert_equal true, GitHub::Markup.can_render?('README.markdown') + assert_equal true, GitHub::Markup.can_render?('README.rmd') assert_equal false, GitHub::Markup.can_render?('README.cmd') assert_equal true, GitHub::Markup.can_render?('README.litcoffee') end diff --git a/test/markups/README.rmd b/test/markups/README.rmd new file mode 100644 index 00000000..f9f5f702 --- /dev/null +++ b/test/markups/README.rmd @@ -0,0 +1,3 @@ +# Title +* One +* Two diff --git a/test/markups/README.rmd.html b/test/markups/README.rmd.html new file mode 100644 index 00000000..e712d1c7 --- /dev/null +++ b/test/markups/README.rmd.html @@ -0,0 +1,6 @@ +

Title

+ + From bde4a7b244ac6b82b2bfd7429e6d5ed798d913f0 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 11 Sep 2014 16:03:31 -0400 Subject: [PATCH 2/3] Perform case-insensitive test for file extensions --- lib/github/markup/implementation.rb | 2 +- test/markup_test.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb index 463a39d4..9962d182 100644 --- a/lib/github/markup/implementation.rb +++ b/lib/github/markup/implementation.rb @@ -21,7 +21,7 @@ def match?(filename) private def file_ext_regexp - @file_ext_regexp ||= /\.(#{regexp})\z/ + @file_ext_regexp ||= /\.(#{regexp})\z/i end end end diff --git a/test/markup_test.rb b/test/markup_test.rb index cc7f74bf..7a1f459f 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -36,6 +36,7 @@ def test_knows_what_it_can_and_cannot_render assert_equal false, GitHub::Markup.can_render?('README.html') assert_equal true, GitHub::Markup.can_render?('README.markdown') assert_equal true, GitHub::Markup.can_render?('README.rmd') + assert_equal true, GitHub::Markup.can_render?('README.Rmd') assert_equal false, GitHub::Markup.can_render?('README.cmd') assert_equal true, GitHub::Markup.can_render?('README.litcoffee') end From d41a9e1fe65225e727f03ed68aa4849ef4b97816 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Thu, 11 Sep 2014 16:49:21 -0400 Subject: [PATCH 3/3] Case-insensitive on just markdown --- lib/github/markup/implementation.rb | 2 +- lib/github/markup/markdown.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/github/markup/implementation.rb b/lib/github/markup/implementation.rb index 9962d182..463a39d4 100644 --- a/lib/github/markup/implementation.rb +++ b/lib/github/markup/implementation.rb @@ -21,7 +21,7 @@ def match?(filename) private def file_ext_regexp - @file_ext_regexp ||= /\.(#{regexp})\z/i + @file_ext_regexp ||= /\.(#{regexp})\z/ end end end diff --git a/lib/github/markup/markdown.rb b/lib/github/markup/markdown.rb index 07f7ff87..8ad9722f 100644 --- a/lib/github/markup/markdown.rb +++ b/lib/github/markup/markdown.rb @@ -25,7 +25,7 @@ class Markdown < Implementation } def initialize - super(/md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/) + super(/md|rmd|mkdn?|mdwn|mdown|markdown|litcoffee/i) end def load