scratch/Rules
Yann Esposito (Yogsototh) dbd094dfbb Gestion des feeds fr et en
2010-04-02 12:44:33 +02:00

83 lines
1.5 KiB
Ruby

#!/usr/bin/env ruby
# engendrement des fichiers html
# page d'Accueil
#route '/' do
# '/index.html'
#end
# CSS
compile '/css/*' do
filter :sass
end
route '/css/*' do
'/Scratch/assets' + item.identifier.chop + '.css'
end
compile '/css/raw/*' do
end
route '/css/raw/*' do
'/Scratch' + item.identifier.sub(/raw\//,'').chop + '.css'
end
# JS
compile '/js/*' do
end
route '/js/*' do
'/Scratch/assets' + item.identifier.chop + '.js'
end
# HTML
# compile '/*' do
# filter :erb
# filter :bluecloth
# layout 'default'
# end
compile '/html/*' do
# item[:extension] returns 'html.erb' for multi-dotted filename
ext = item[:extension].nil? ? nil : item[:extension].split('.').last
filter :ultraviolet # must be before kramdown
if ext == 'erb'
filter :erb
elsif ext == 'haml' || ext.nil?
filter :haml
elsif ext == 'md' || ext == 'markdown'
filter :erb
filter :kramdown
else
raise "Filter is not configured for #{item.identifier} in Rules file."
end
filter :multicorps # must be before firsthi
filter :firsthi # must be after multicorps
filter :description
filter :frenchspace
filter :ytypo
filter :yabbreviations
layout 'default' unless item[:layout] == "none"
end
route '/html/*' do
'/Scratch' + item.identifier.sub('/html','') + 'index.html'
end
# feed
compile '/xml/*' do
layout 'feed'
end
route '/xml/en/*' do
'/Scratch/en/feed.xml'
end
route '/xml/fr/*' do
'/Scratch/fr/feed.xml'
end
layout '*', :erb