106 lines
2 KiB
Ruby
106 lines
2 KiB
Ruby
#!/usr/bin/env ruby
|
||
|
||
preprocess do
|
||
merge_location_data
|
||
generate_event_pages
|
||
generate_activity_pages
|
||
generate_archive_pages
|
||
generate_twitter_archive_pages
|
||
end
|
||
|
||
|
||
compile %r{/_} do
|
||
nil
|
||
end
|
||
|
||
compile '/styles/*' do
|
||
if item[:extension]=="scss" && !item.identifier.split("/")[-1].start_with?("_")
|
||
filter :sass, {
|
||
:load_paths => ["#{Dir.pwd}/content/styles", "#{Dir.pwd}/bootstrap-sass/vendor/assets/stylesheets", "#{Dir.pwd}/Font-Awesome/scss"],
|
||
:syntax => :scss,
|
||
:style => :compact
|
||
#:style => :compressed
|
||
}
|
||
end
|
||
end
|
||
|
||
compile "/htaccess" do
|
||
filter :erb
|
||
end
|
||
|
||
compile "atom" do
|
||
filter :erb
|
||
end
|
||
|
||
compile '*' do
|
||
item_name = if item.identifier=="/"
|
||
""
|
||
else
|
||
item.identifier.split("/")[-1]
|
||
end
|
||
if item.binary?
|
||
# don’t filter binary items
|
||
else
|
||
case item[:extension]
|
||
when 'md','markdown' then
|
||
filter :rdiscount, { :extensions => [ :smart ] }
|
||
end
|
||
filter :erb
|
||
if item_name.start_with?("_")
|
||
nil
|
||
else
|
||
if item[:style]!='none'
|
||
#layout 'default'
|
||
layout item[:style] || 'default'
|
||
end
|
||
end
|
||
end
|
||
end
|
||
|
||
route %r{/_} do
|
||
nil
|
||
end
|
||
|
||
route '/static/*' do
|
||
item.identifier[7..-2]
|
||
end
|
||
|
||
route '/styles/*' do
|
||
item.identifier.chop + '.css'
|
||
end
|
||
|
||
route "/htaccess" do
|
||
"/.htaccess"
|
||
end
|
||
|
||
route "/atom" do
|
||
item.identifier.chop + '.xml'
|
||
end
|
||
|
||
route '/articles/*' do
|
||
# Find corresponding article (for getting metadata)
|
||
articleitem = article_base_item(item)
|
||
if articleitem
|
||
# Create directory basename
|
||
url = '/' + pathname_of_article(articleitem)
|
||
# Main article goes to index.html, don't touch other filenames
|
||
if item.equal? articleitem then
|
||
url + '/index.html'
|
||
else
|
||
idparts = item.identifier.split('/')
|
||
url + "/#{idparts.last}.#{item[:extension]}"
|
||
end
|
||
else
|
||
nil
|
||
end
|
||
end
|
||
|
||
route '*' do
|
||
if item.binary?
|
||
item.identifier.chop + '.' + item[:extension]
|
||
else
|
||
item.identifier.chop + '/index.html'
|
||
end
|
||
end
|
||
|
||
layout '*', :erb
|