zeus.ugent.be/Rules
2018-07-05 11:36:11 +02:00

217 lines
3 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_content('blog', 'events', 'about/verslagen') if development?
update_blog_attributes
create_yearly_items('Blog')
create_yearly_items('Events')
convert_event_time_to_timestamps
all_events.each do |event|
check_schema(:event, event)
end
add_report_metadata
end
#
#
# COMPILATION
#
#
compile '/*.xml' do
filter :erb
end
#
# ARCHIVES
#
compile '/blog/*' do
layout '/archive_page.*'
layout '/generic.*'
layout '/default.*'
filter :erb
filter :html_press
end
#
# EVENTS
#
# Overview page
compile '/events/*' do
layout '/events.*'
layout '/generic.*'
layout '/default.*'
filter :erb
filter :html_press
end
compile '/events/*/*' do
filter :erb
filter :kramdown
layout '/eventpost.*'
layout '/default.*'
filter :erb
filter :html_press
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/*/*.md' do
filter :erb
layout '/blogpost.md'
filter :kramdown
filter :typogruby
layout '/blogpost.erb'
layout '/generic.*'
layout '/default.*'
filter :erb
filter :html_press
end
compile '/blog/*/*.md', rep: :text do
filter :erb
filter :kramdown
filter :strip_html
end
compile '/blog/*/*.md', rep: :html do
filter :erb
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.*'
filter :html_press
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, harmony: true
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
compile '/assets/stylesheets/**/*.css' do
filter :rainpress
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