2010-10-05 14:17:54 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
# engendrement des fichiers html
|
|
|
|
|
|
|
|
# page d'Accueil
|
|
|
|
#route '/' do
|
|
|
|
# '/index.html'
|
|
|
|
#end
|
|
|
|
|
|
|
|
# CSS
|
|
|
|
compile '/css/*' do
|
|
|
|
filter :sass
|
|
|
|
filter :rainpress
|
|
|
|
end
|
|
|
|
route '/css/*' do
|
2011-04-20 13:56:52 +00:00
|
|
|
'/Scratch/assets' + item.identifier.chop + '.css'
|
2010-10-05 14:17:54 +00:00
|
|
|
end
|
|
|
|
compile '/img/*' do
|
|
|
|
end
|
|
|
|
route '/img/*' do
|
2011-04-20 13:56:52 +00:00
|
|
|
'/Scratch/assets' + item.identifier.chop + '.png'
|
2010-10-05 14:17:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
compile '/css/raw/*' do
|
|
|
|
end
|
|
|
|
route '/css/raw/*' do
|
2011-04-20 13:56:52 +00:00
|
|
|
'/Scratch' + item.identifier.sub(/raw\//,'').chop + '.css'
|
2010-10-05 14:17:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# JS
|
|
|
|
compile '/js/*' do
|
|
|
|
end
|
|
|
|
route '/js/*' do
|
2011-04-20 13:56:52 +00:00
|
|
|
'/Scratch/assets' + item.identifier.chop + '.js'
|
2010-10-05 14:17:54 +00:00
|
|
|
end
|
|
|
|
|
2010-12-01 16:36:28 +00:00
|
|
|
compile '/html' do
|
|
|
|
filter :erb
|
|
|
|
layout 'default' unless item[:layout] == "none"
|
|
|
|
end
|
|
|
|
route '/html' do
|
|
|
|
'/index.html'
|
|
|
|
end
|
2010-10-05 14:17:54 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
filter :graph
|
|
|
|
filter :description
|
2010-10-20 15:20:28 +00:00
|
|
|
filter :falacy
|
2010-10-05 14:17:54 +00:00
|
|
|
|
|
|
|
if ext == 'erb'
|
|
|
|
filter :erb
|
|
|
|
elsif ext == 'haml' || ext.nil?
|
|
|
|
filter :haml
|
|
|
|
elsif ext == 'md' || ext == 'markdown'
|
|
|
|
filter :erb
|
|
|
|
filter :kramdown
|
2011-11-16 11:57:39 +00:00
|
|
|
# filter :math_repair # after kramdown
|
2010-10-05 14:17:54 +00:00
|
|
|
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 :frenchspace
|
|
|
|
filter :ytypo
|
|
|
|
# filter :yabbreviations
|
|
|
|
filter :footnotes
|
|
|
|
|
|
|
|
if item[:kind] == 'article'
|
|
|
|
layout 'article'
|
|
|
|
elsif not item[:layout].nil?
|
|
|
|
layout item[:layout]
|
|
|
|
else
|
|
|
|
layout 'default' unless item[:layout] == "none"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
route '/html/*' do
|
2011-04-20 13:56:52 +00:00
|
|
|
'/Scratch' + item.identifier.sub('/html','') + 'index.html'
|
2010-10-05 14:17:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# feed
|
|
|
|
compile '/xml/*' do
|
|
|
|
layout 'feed'
|
|
|
|
end
|
|
|
|
|
|
|
|
route '/xml/en/*' do
|
2011-04-20 13:56:52 +00:00
|
|
|
'/Scratch/en/blog/feed/feed.xml'
|
2010-10-05 14:17:54 +00:00
|
|
|
end
|
|
|
|
route '/xml/fr/*' do
|
2011-04-20 13:56:52 +00:00
|
|
|
'/Scratch/fr/blog/feed/feed.xml'
|
2010-10-05 14:17:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
compile '/sitemap/*' do
|
|
|
|
layout 'sitemap'
|
|
|
|
end
|
|
|
|
route '/sitemap/*' do
|
2011-04-20 13:56:52 +00:00
|
|
|
'/Scratch/sitemap.xml'
|
2010-10-05 14:17:54 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
layout '*', :erb
|
|
|
|
|