sharieswebsite/Rules
Yann Esposito (Yogsototh) 739e68ea34 Added nanoc stuff
2011-05-02 12:09:43 +02:00

107 lines
2 KiB
Ruby

#!/usr/bin/env ruby
# engendrement des fichiers html
# page d'Accueil
#route '/' do
# '/index.html'
#end
# CSS
compile '/css/*' do
filter :no_custom_css
filter :sass
filter :rainpress
end
route '/css/*' do
'/Scratch/assets' + item.identifier.chop + '.css'
end
compile '/img/*' do
end
route '/img/*' do
'/Scratch/assets' + item.identifier.chop + '.png'
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
compile '/html' do
filter :erb
layout 'main' unless item[:layout] == "none"
end
route '/html' do
'/index.html'
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
filter :graph
filter :description
filter :falacy
if ext == 'erb'
filter :erb
elsif ext == 'haml' || ext.nil?
filter :haml
elsif ext == 'md' || ext == 'markdown'
filter :erb
filter :kramdown
filter :math_repair # after 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 :frenchspace
filter :ytypo
# filter :yabbreviations
filter :footnotes
if item[:kind] == 'article'
layout 'main'
elsif not item[:layout].nil?
layout item[:layout]
else
layout 'main' unless item[:layout] == "none"
end
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/blog/feed/feed.xml'
end
route '/xml/fr/*' do
'/Scratch/fr/blog/feed/feed.xml'
end
compile '/sitemap/*' do
layout 'sitemap'
end
route '/sitemap/*' do
'/Scratch/sitemap.xml'
end
layout '*', :erb