zeus.ugent.be/Rules
2018-03-08 22:44:19 +01:00

194 lines
2.6 KiB
Ruby

#!/usr/bin/env ruby
# frozen_string_literal: true
require 'json'
require 'icalendar'
#
#
# PREPROCESS
#
#
preprocess do
`npm install`
# We don't want to compile old blogposts in development
ignore_old_blogposts if development?
update_blog_attributes
create_yearly_items('Blog')
create_yearly_items('Events')
convert_event_time_to_timestamps
add_report_metadata
end
#
#
# COMPILATION
#
#
compile '/*.xml' do
filter :erb
end
#
# ARCHIVES
#
compile '/blog/*' do
layout '/archive_page.*'
layout '/generic.*'
layout '/default.*'
filter :erb
end
#
# EVENTS
#
# Overview page
compile '/events/*' do
layout '/events.*'
layout '/generic.*'
layout '/default.*'
filter :erb
end
compile '/events/*/*' do
filter :erb
filter :kramdown
layout '/eventpost.*'
layout '/default.*'
filter :erb
end
compile '/events/*/*', rep: :text do
filter :kramdown
filter :strip_html
end
compile '/events/*/*', rep: :ical do
filter :ical
write ext: 'ics'
end
#
# POSTS
#
compile '/blog/*/*' do
filter :erb
layout '/blogpost.md'
filter :kramdown
layout '/blogpost.erb'
layout '/generic.*'
layout '/default.*'
filter :erb
filter :typogruby
end
compile '/blog/*/*', rep: :text do
filter :kramdown
filter :strip_html
end
compile '/blog/*/*', rep: :html do
filter :kramdown
end
#
# PROJECTS
#
compile '/projects/*' do
filter :kramdown
# Don't write out the projects themselves for now
write nil
end
compile '/*_search.json' do
filter :erb
end
compile '/**/*.ics' do
filter :erb
end
#
# REPORTS
#
compile '/about/verslagen/*/*.md', rep: :pdf do
filter :pandoc_pdf, args: { f: :markdown }
write ext: 'pdf'
end
#
# GENERIC ERB PAGES
#
compile '/**/*.erb' do
filter :erb
layout '/generic.*'
layout '/default.*'
end
compile '/**/*.md' do
filter :erb
filter :kramdown
layout '/generic.*'
layout '/default.*'
end
#
# ASSETS
#
compile '/assets/scripts/**/*.coffee' do
filter :coffeescript
filter :uglify_js
write ext: 'js'
end
compile '/assets/scripts/**/*.js' do
filter :uglify_js
end
ignore '/assets/stylesheets/includes/**/*'
ignore '/data/**/*'
compile '/assets/stylesheets/**/*.scss' do
filter :sass, syntax: :scss, style: :compressed
filter :autoprefixer if production?
write ext: 'css'
end
#
#
# ROUTES
#
#
# Google verification file
passthrough '/google6f2e77d0228abc35.html'
route '/**/index.{erb,html,md}' do
"#{item.identifier.without_ext}.html"
end
route '/**/*.{erb,html,md}' do
"#{item.identifier.without_ext}/index.html"
end
# Let anything else simply pass through
passthrough '/**/*'
#
#
# LAYOUTS
#
#
layout '/**/*', :erb