Skip to content

Instantly share code, notes, and snippets.

@robertbrook
Created March 25, 2011 10:37
Show Gist options
  • Save robertbrook/886667 to your computer and use it in GitHub Desktop.
Save robertbrook/886667 to your computer and use it in GitHub Desktop.
siter.rb
require 'redcloth'
require 'erb'
task :default => [:test]
TEXTFILES = FileList['**/*.txt']
desc "list txt files"
task :test do
puts TEXTFILES
end
template = ERB.new %q{<!doctype html>
<html>
<head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>a page</title>
<style>body {font-family:"Helvetica Neue",helvetica,sans-serif;width:480px;margin:40px auto;line-height:140%;font-size:1.8em;font-weight:bold;}
address {font-style:normal;}
h1 {color:crimson;}
</style></head>
<body><header></header><section><%= clothed %></section><footer><address>mail@robertbrook.com</address></footer></body>
</html>}
desc "redclothing"
task :red do
TEXTFILES.each do |txt_file|
clothed = RedCloth.new(IO.read(txt_file)).to_html
File.open(txt_file.ext("html"), "w") do |f|
f.write template.result(binding)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment