all repos — markup @ ff6133f87a4c5f662525cb2fca8fabfb9775d277

The code we use to render README.your_favorite_markup

Missing commands return the input (instead of nothing)
Chris Wanstrath chris@ozmm.org
Tue, 17 Nov 2009 11:13:43 -0800
commit

ff6133f87a4c5f662525cb2fca8fabfb9775d277

parent

dc002b302b9ed5470f746209e89d6eb07c7c0d1b

3 files changed, 15 insertions(+), 0 deletions(-)

jump to
M HISTORY.mdHISTORY.md

@@ -1,3 +1,7 @@

+## 0.1.4 (2009-11-17) + +* Bugfix: Missing commands return the input (instead of nothing) + ## 0.1.3 (2009-11-02) * Strip the INDEX comments from POD
M lib/github/markup.rblib/github/markup.rb

@@ -26,6 +26,7 @@ end

def command(command, regexp, &block) command = command.to_s + if !File.exists?(command) && !command.include?('/') command = File.dirname(__FILE__) + '/commands/' + command.to_s end

@@ -54,6 +55,8 @@ nil

end def execute(command, target) + return target if !system("which #{command} > /dev/null") + out = '' Open3.popen3(command) do |stdin, stdout, _| stdin.puts target
M test/markup_test.rbtest/markup_test.rb

@@ -26,4 +26,12 @@ assert_equal false, GitHub::Markup.can_render?('README.html')

assert_equal true, GitHub::Markup.can_render?('README.markdown') assert_equal false, GitHub::Markup.can_render?('README.cmd') end + + def test_fails_gracefully_on_missing_commands + GitHub::Markup.command(:i_made_it_up, /mde/) + text = 'hi there' + assert_equal true, GitHub::Markup.can_render?('README.mde') + actual = GitHub::Markup.render('README.mde', text) + assert_equal text, actual + end end