Skip to content

Commit

Permalink
Converting: add task for clearing html output
Browse files Browse the repository at this point in the history
  • Loading branch information
shir committed Jun 28, 2011
1 parent 6a2ca35 commit ef2d037
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/tasks/converting.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ ROOT_DIR = File.expand_path(File.join('..', '..', '..'), __FILE__)
MD_DIR = File.join(ROOT_DIR, 'markdown')
HTML_DIR = File.join(ROOT_DIR, 'html')
MD_EXTENSION = '.md'
HTML_EXTENSION = '.html'

def output_file(input_file)
input_file.gsub(/^#{Regexp.escape(MD_DIR)}/, Regexp.escape(HTML_DIR)).
gsub(/#{Regexp.escape(MD_EXTENSION)}$/, '.html')
gsub(/#{Regexp.escape(MD_EXTENSION)}$/, HTML_EXTENSION)
end

def syntax_highlighter(html)
Expand Down Expand Up @@ -37,4 +38,9 @@ namespace :convert do
convert_file_to_html(file, output_file(file))
end
end

desc 'Remove all HTML ouput files'
task [:html, :clear] do
FileUtils.remove_dir(HTML_DIR)
end
end

0 comments on commit ef2d037

Please sign in to comment.