Skip to content

Commit

Permalink
okay now you can pass a block to command to tinker with the output
Browse files Browse the repository at this point in the history
  • Loading branch information
defunkt committed Oct 31, 2009
1 parent 3861e48 commit 8a8b52e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/github/markup.rb
Expand Up @@ -20,14 +20,15 @@ def markup(file, pattern, &block)
nil nil
end end


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


add_markup(regexp) do |content| add_markup(regexp) do |content|
execute(command, content) rendered = execute(command, content)
block ? block.call(rendered) : rendered
end end
end end


Expand Down

0 comments on commit 8a8b52e

Please sign in to comment.