desc "generate document files"
task :doc do
require 'redcarpet'
require 'pathname'
FileList['doc/*.md'].each do |md|
target = Pathname.new(md)
header = <<-HEADER
#{target.basename('.md')}
HEADER
footer = <<-FOOTER
FOOTER
html = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :fenced_code_blocks => true).render(File.open(md).read)
open(target.sub(/\.md\z/, '.html'), 'w') {|f| f.write(header + html + footer)}
end
end
# Local Variables:
# mode: ruby
# indent-tabs-mode: t
# tab-width: 3
# ruby-indent-level: 3
# End:
# vim: ts=3