2010-01-21 06:25:44 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require 'compass'
|
2010-01-31 17:43:19 +00:00
|
|
|
|
|
|
|
Compass.add_configuration "#{File.dirname(__FILE__)}/.compass/config.rb"
|
2010-01-21 06:25:44 +00:00
|
|
|
|
2010-11-22 01:11:43 +00:00
|
|
|
SITE_ROOT = ""
|
2010-01-28 09:11:42 +00:00
|
|
|
|
2010-01-27 07:05:57 +00:00
|
|
|
compile '/assets/*/' do
|
2010-01-24 09:34:05 +00:00
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
2010-04-20 18:09:09 +00:00
|
|
|
['markup', 'stylesheet', 'background'].each do |ex_file|
|
|
|
|
compile "/examples/*/#{ex_file}/" do
|
2010-03-28 09:49:58 +00:00
|
|
|
nil
|
|
|
|
end
|
2010-01-27 06:08:13 +00:00
|
|
|
end
|
|
|
|
|
2010-04-20 18:09:09 +00:00
|
|
|
compile '/' do
|
|
|
|
filter :haml, :ugly => true
|
2010-12-18 22:29:12 +00:00
|
|
|
layout item[:layout] ? item[:layout] : "main"
|
2010-04-20 18:09:09 +00:00
|
|
|
end
|
|
|
|
|
2010-05-08 18:07:31 +00:00
|
|
|
compile '/search-data/' do
|
|
|
|
filter :erb
|
|
|
|
end
|
|
|
|
|
2010-01-27 06:08:13 +00:00
|
|
|
compile '/examples/*/' do
|
|
|
|
filter :haml, :ugly => true
|
2010-11-15 22:41:45 +00:00
|
|
|
filter :highlight
|
2010-12-18 22:29:12 +00:00
|
|
|
layout item[:layout] ? item[:layout] : "example"
|
2010-01-27 06:08:13 +00:00
|
|
|
end
|
|
|
|
|
2010-04-20 18:09:09 +00:00
|
|
|
sass_options = Compass.sass_engine_options
|
|
|
|
|
|
|
|
(0..5).each do |i|
|
|
|
|
compile("/stylesheets/#{'*/' * i}_*/") {nil}
|
|
|
|
end
|
|
|
|
|
|
|
|
compile '/stylesheets/*' do
|
|
|
|
filter :sass, sass_options.merge(:syntax => item[:extension].to_sym)
|
2010-01-21 06:25:44 +00:00
|
|
|
end
|
|
|
|
|
2010-02-07 21:58:52 +00:00
|
|
|
compile '/reference/*/' do
|
|
|
|
filter :haml, :ugly => true
|
2010-11-15 22:41:45 +00:00
|
|
|
filter :highlight
|
2010-12-18 22:29:12 +00:00
|
|
|
layout item[:layout] ? item[:layout] : "main"
|
2010-02-07 21:58:52 +00:00
|
|
|
end
|
|
|
|
|
2011-04-17 08:48:44 +00:00
|
|
|
compile '/posts/*/' do
|
|
|
|
filter :erb
|
|
|
|
filter :rdiscount if item[:extension] == "markdown"
|
|
|
|
layout 'post'
|
|
|
|
end
|
|
|
|
|
|
|
|
compile "/blog/atom/" do
|
|
|
|
filter :haml, :attr_wrapper => '"'
|
|
|
|
end
|
|
|
|
|
2011-04-29 03:44:47 +00:00
|
|
|
compile 'sitemap' do
|
|
|
|
filter :erb
|
|
|
|
end
|
|
|
|
|
2010-01-21 06:25:44 +00:00
|
|
|
compile '*' do
|
2010-04-25 18:28:03 +00:00
|
|
|
if item[:extension] == "markdown"
|
|
|
|
filter :rdiscount
|
|
|
|
elsif item[:extension] == "haml"
|
|
|
|
filter :haml, :ugly => true
|
|
|
|
end
|
2010-12-18 22:29:12 +00:00
|
|
|
layout item[:layout] ? item[:layout] : "main"
|
2010-01-21 06:25:44 +00:00
|
|
|
end
|
|
|
|
|
2011-04-29 03:44:47 +00:00
|
|
|
route 'sitemap' do
|
|
|
|
item.identifier.chop + '.xml'
|
|
|
|
end
|
|
|
|
|
2011-04-17 08:48:44 +00:00
|
|
|
route "/blog/atom/" do
|
|
|
|
"/blog/atom.xml"
|
|
|
|
end
|
|
|
|
|
2010-05-08 18:07:31 +00:00
|
|
|
route '/search-data/' do
|
|
|
|
"#{SITE_ROOT}/javascripts"+item.identifier[0..-2]+".js"
|
|
|
|
end
|
|
|
|
|
2010-04-20 18:09:09 +00:00
|
|
|
(0..5).each do |i|
|
|
|
|
route("/stylesheets/#{'*/' * i}_*/") {nil}
|
2010-01-21 06:25:44 +00:00
|
|
|
end
|
2010-01-23 09:08:00 +00:00
|
|
|
|
2010-12-18 22:08:21 +00:00
|
|
|
route '/assets/htaccess/' do
|
|
|
|
"#{SITE_ROOT}/.htaccess"
|
|
|
|
end
|
|
|
|
|
2010-01-27 07:05:57 +00:00
|
|
|
route '/assets/css/*/' do
|
2010-01-28 09:11:42 +00:00
|
|
|
"#{SITE_ROOT}/stylesheets"+item.identifier.chop[11..-1]+"."+item[:extension]
|
2010-01-23 09:08:00 +00:00
|
|
|
end
|
|
|
|
|
2010-01-27 07:05:57 +00:00
|
|
|
route '/assets/images/*/' do
|
2010-01-28 09:11:42 +00:00
|
|
|
SITE_ROOT+item.identifier.chop[7..-1]+"."+item[:extension]
|
2010-01-24 09:34:05 +00:00
|
|
|
end
|
|
|
|
|
2010-01-27 07:05:57 +00:00
|
|
|
route '/assets/javascripts/*/' do
|
2010-01-28 09:11:42 +00:00
|
|
|
SITE_ROOT+item.identifier.chop[7..-1]+"."+item[:extension]
|
2010-01-23 09:08:00 +00:00
|
|
|
end
|
|
|
|
|
2010-03-29 06:53:57 +00:00
|
|
|
route '/assets/fonts/*/' do
|
|
|
|
SITE_ROOT+item.identifier.chop[7..-1]+"."+item[:extension]
|
|
|
|
end
|
|
|
|
|
2010-01-21 06:25:44 +00:00
|
|
|
route '/stylesheets/*/' do
|
|
|
|
# don't generate a directory like we do for HTML files
|
2010-01-28 09:11:42 +00:00
|
|
|
SITE_ROOT+item.identifier.chop + '.css'
|
2010-01-21 06:25:44 +00:00
|
|
|
end
|
|
|
|
|
2011-04-17 08:48:44 +00:00
|
|
|
route '/posts/*/' do
|
|
|
|
if item.identifier =~ %r{^/posts/(\d{4})-(\d{2})-(\d{2})-(.*)/$}
|
|
|
|
"/blog/#{$1}/#{$2}/#{$3}/#{$4}/index.html"
|
|
|
|
else
|
|
|
|
puts "WARNING: malformed post name: #{item.identifier}"
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-04-21 05:43:25 +00:00
|
|
|
%w(markup stylesheet background).each do |ex_file|
|
|
|
|
route "/examples/*/#{ex_file}/" do
|
2010-03-28 09:49:58 +00:00
|
|
|
nil
|
|
|
|
end
|
2010-01-27 06:08:13 +00:00
|
|
|
end
|
|
|
|
|
2010-01-21 06:25:44 +00:00
|
|
|
route '*' do
|
2010-01-28 09:11:42 +00:00
|
|
|
SITE_ROOT+item.identifier + 'index.html'
|
2010-01-21 06:25:44 +00:00
|
|
|
end
|
|
|
|
|
2010-01-23 02:15:04 +00:00
|
|
|
layout '*', :haml, :ugly => true
|