scratch/Rules

107 lines
2.1 KiB
Text
Raw Permalink Normal View History

#!/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
'/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
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
compile '/html/*' do
# item[:extension] returns 'html.erb' for multi-dotted filename
ext = item[:extension].nil? ? nil : item[:extension].split('.').last
if ext == 'erb'
filter :erb
elsif ext == 'haml' || ext.nil?
filter :haml
elsif ext == 'md' || ext == 'markdown'
2013-01-02 15:46:44 +00:00
filter :code
2012-12-12 10:09:15 +00:00
filter :graph
filter :description
filter :falacy
filter :blogimage
2013-01-03 15:21:21 +00:00
filter :erb # I should try to remove all erb code inside markdown
filter :kramdown
2012-12-20 12:21:47 +00:00
filter :fix_img
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
2012-12-20 15:01:25 +00:00
if not item[:layout].nil?
layout item[:layout]
2012-12-20 15:01:25 +00:00
elsif item[:kind] == 'article'
layout 'article'
else
layout 'default' 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