From 17cfddbbf7e9bc5d026bfd65b3c3affd2889ca5d Mon Sep 17 00:00:00 2001 From: Darren Wallace Date: Sun, 5 Jun 2011 21:40:18 +0100 Subject: [PATCH] Added guard template --- lib/guard/markdown/templates/Guardfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/guard/markdown/templates/Guardfile b/lib/guard/markdown/templates/Guardfile index 89ff73a..008ac22 100644 --- a/lib/guard/markdown/templates/Guardfile +++ b/lib/guard/markdown/templates/Guardfile @@ -1,4 +1,9 @@ -guard 'markdown' do - watch(%r{^source_docs/.+\.md}) - watch(%r{^source_docs/.+\.markdown}) +guard 'markdown' do + # must produce a string => "input/path/file.md|target/path/output/file.html" + # The first regexp, watch (regexp) is used to match the files to be watched for changes + # The second regexp is used to determine the input path of the changed file, and the desired output path + # of the converted file, both built by the regexp matched against the detected changed file. + # The goal is to create a string of the form "input/path/file.md|output/path/file.html", + # i.e, both the input file path and the output file path separated by a pipe. + watch (/source_dir\/(.+\/)*(.+\.)(md|markdown)/i) { |m| "source_dir/#{m[1]}#{m[2]}#{m[3]}|output_dir/#{m[1]}#{m[2]}html"} end \ No newline at end of file