Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
143 lines (116 sloc) 2.36 KB
#!/usr/bin/env ruby
compile /^\/(archives|home)\// do
filter :erb
layout 'default'
end
compile /^\/(projects|about)/ do
filter :erb
filter :redcloth
layout 'default'
end
compile /(rss|atom)/ do
filter :erb unless rep.binary? # e.g. rss.png image
end
compile '/styles/_*/' do
end
compile '/styles/*' do
if item[:extension] == "scss" && item.identifier.match(/style\/$/) then
filter :sass, {
:load_paths => [Dir.pwd+"/content/styles"],
:syntax => :scss,
:style => :compact
}
end
end
compile "sitemap" do
filter :erb
end
compile /^\/(js\/.+?)/ do
# do nothing
end
compile '/glyph/book/*' do
# do nothing
end
compile '/ruby-compendium/book/*' do
# do nothing
end
compile '*' do
if item[:filters_pre] && !item[:filters_pre].empty? then
item[:filters_pre].each do |f|
filter f.to_sym
end
layout 'default'
else
unless rep.binary? then
case item[:extension]
when 'textile' then
filter :redcloth
layout 'default'
when 'md','markdown' then
filter :bluecloth
layout 'default'
when 'bbcode' then
filter :bbcode
layout 'default'
when 'glyph' then
pdf_file = Pathname.new "#{Dir.pwd}/output#{item.identifier.gsub(/\/$/, '')}.pdf"
glyph_config @item
glyph_pdf_for @item unless pdf_file.exist?
glyph_article_for @item
Glyph.reset
end
end
end
end
route /^\/tags\/.+?-(atom|rss)/ do
item.identifier.gsub(/(.+)-(rss|atom)\/$/, '\1/\2') + '.xml'
end
route '/(atom|rss)/' do
item.identifier.chop + '.xml'
end
route '/css/*' do
item.identifier.chop + '.css'
end
route '/styles/_*/' do
nil
end
route '/styles/*' do
item.identifier.chop + '.css'
end
route '/glyph/book/' do
'/glyph/book/index.html'
end
route '/ruby-compendium/book/' do
'/ruby-compendium/book/index.html'
end
route '/glyph/book/images/glyph/*' do
item.identifier.chop + ".#{item[:extension]}"
end
route '/glyph/book/*' do
item.identifier.chop+'.html'
end
route '/ruby-compendium/book/*' do
item.identifier.chop+'.html'
end
route '/home/' do
"/index.html"
end
route '/sitemap' do
item.identifier.chop + '.xml'
end
route "/htaccess" do
"/.htaccess"
end
route /\/(images|img|files|favicon|robots)\// do
item.identifier.chop + ".#{item[:extension]}"
end
route '/js/*' do
item.identifier.chop + '.js'
end
route '/fonts/*' do
item.identifier.chop + '.otf'
end
route '*' do
item.identifier + 'index.html'
end
layout '*', :erb
Something went wrong with that request. Please try again.