It's possible to pass a regular expression as a rule pattern in the rule definition. The following example shows you how to do it:
rule /\.html$/ => '.md' do |t| sh "pandoc -s #{t.source} -o #{t.name}" end
We used the new method in the preceding example, source
, which is called on the task. Its name explicitly says what it does—it returns the name of the source. In our case, this is the Markdown file.