zeus.ugent.be/Rules

226 lines
3.3 KiB
Text
Raw Normal View History

2016-06-09 14:27:23 +02:00
#!/usr/bin/env ruby
2016-07-19 08:39:52 +02:00
# frozen_string_literal: true
2016-06-09 14:27:23 +02:00
2016-07-20 14:38:50 +02:00
require 'json'
2016-07-27 00:13:36 +02:00
require 'icalendar'
2016-07-20 14:38:50 +02:00
2016-07-23 22:43:46 +02:00
#
#
# PREPROCESS
#
#
2016-07-20 14:38:50 +02:00
preprocess do
2018-10-14 17:10:53 +02:00
`yarn`
# We don't want to compile old blogposts in development
ignore_old_content('blog', 'events', 'about/verslagen') if development?
2016-12-11 00:55:11 +01:00
update_blog_attributes
create_yearly_items('Blog')
create_yearly_items('Events')
2016-12-11 00:55:11 +01:00
convert_event_time_to_timestamps
2018-03-01 16:33:12 +01:00
all_events.each do |event|
check_schema(:event, event)
end
2018-02-25 20:29:35 +01:00
add_report_metadata
2016-07-20 14:38:50 +02:00
end
2016-07-23 22:43:46 +02:00
#
#
# COMPILATION
#
#
2017-05-29 14:36:20 +02:00
compile '/*.xml' do
2016-07-26 20:08:42 +02:00
filter :erb
end
2016-07-23 22:43:46 +02:00
#
# ARCHIVES
#
2016-09-22 21:23:40 +02:00
compile '/blog/*' do
2016-07-23 22:06:06 +02:00
layout '/archive_page.*'
2016-07-23 21:17:24 +02:00
layout '/generic.*'
layout '/default.*'
2016-07-19 10:27:27 +02:00
filter :erb
2018-10-14 17:10:53 +02:00
filter :html_press if production?
2016-06-09 14:27:23 +02:00
end
2016-07-23 22:43:46 +02:00
#
2016-08-23 20:21:02 +02:00
# EVENTS
2016-07-23 22:43:46 +02:00
#
# Overview page
compile '/events/*' do
layout '/events.*'
layout '/generic.*'
layout '/default.*'
filter :erb
2018-10-14 17:10:53 +02:00
filter :html_press if production?
end
compile '/events/*/*' do
filter :erb
2016-06-09 15:04:10 +02:00
filter :kramdown
2016-07-18 09:24:24 +02:00
2016-07-19 10:27:27 +02:00
layout '/eventpost.*'
layout '/default.*'
2016-07-12 23:58:08 +02:00
filter :erb
2018-10-14 17:10:53 +02:00
filter :html_press if production?
2016-06-09 15:04:10 +02:00
end
2016-06-09 14:27:23 +02:00
compile '/events/*/*', rep: :text do
2016-07-20 17:52:56 +02:00
filter :kramdown
filter :strip_html
end
compile '/events/*/*', rep: :ical do
2016-07-27 00:13:36 +02:00
filter :ical
2017-03-15 18:32:36 +01:00
write ext: 'ics'
2016-07-27 00:13:36 +02:00
end
2016-08-23 20:21:02 +02:00
#
# POSTS
#
2018-03-10 11:14:36 +01:00
compile '/blog/*/*.md' do
filter :erb
2016-10-31 12:29:44 +01:00
layout '/blogpost.md'
2016-08-23 20:21:02 +02:00
filter :kramdown
2018-04-10 11:59:20 +02:00
filter :typogruby
2016-08-23 20:21:02 +02:00
2016-10-31 12:29:44 +01:00
layout '/blogpost.erb'
2016-08-23 20:21:02 +02:00
layout '/generic.*'
layout '/default.*'
2016-12-29 13:37:22 +01:00
filter :erb
2018-03-08 22:44:19 +01:00
2018-10-14 17:10:53 +02:00
filter :html_press if production?
2016-08-23 20:21:02 +02:00
end
2018-03-10 11:14:36 +01:00
compile '/blog/*/*.md', rep: :text do
2018-04-13 11:22:02 +02:00
filter :erb
2016-08-23 20:21:02 +02:00
filter :kramdown
filter :strip_html
end
2018-03-10 11:14:36 +01:00
compile '/blog/*/*.md', rep: :html do
2018-04-13 11:22:02 +02:00
filter :erb
2017-10-11 18:26:02 +02:00
filter :kramdown
end
2016-10-03 21:56:08 +02:00
#
# PROJECTS
#
compile '/projects/*' do
filter :kramdown
2018-03-10 11:14:36 +01:00
2018-02-25 20:29:35 +01:00
# Don't write out the projects themselves for now
write nil
2016-10-03 21:56:08 +02:00
end
2016-10-04 16:25:03 +02:00
compile '/*_search.json' do
2016-07-24 13:09:37 +02:00
filter :erb
end
2016-08-04 20:57:25 +02:00
compile '/**/*.ics' do
2016-07-27 00:13:36 +02:00
filter :erb
end
2018-02-25 20:29:35 +01:00
#
# REPORTS
#
compile '/about/verslagen/*/*.md', rep: :pdf do
2018-10-14 17:44:01 +02:00
filter :pandoc_pdf, args: { f: :markdown } if production?
write ext: (production? ? 'pdf' : 'md')
2018-02-25 20:29:35 +01:00
end
2017-05-29 14:36:20 +02:00
#
# GENERIC ERB PAGES
#
2016-11-01 17:11:51 +01:00
compile '/**/*.erb' do
2017-04-23 15:32:18 +02:00
filter :erb
2016-07-23 22:06:06 +02:00
layout '/generic.*'
layout '/default.*'
2018-10-14 17:10:53 +02:00
filter :html_press if production?
2016-07-23 22:06:06 +02:00
end
2017-05-29 22:34:09 +02:00
compile '/**/*.md' do
filter :erb
filter :kramdown
2017-06-14 09:09:37 +02:00
2017-05-29 22:34:09 +02:00
layout '/generic.*'
layout '/default.*'
end
2016-07-23 22:43:46 +02:00
#
# ASSETS
#
compile '/assets/scripts/**/*.coffee' do
filter :coffeescript
2018-10-20 23:52:17 +02:00
filter :uglify_js if production?
2017-03-15 18:32:36 +01:00
write ext: 'js'
2016-07-23 22:43:46 +02:00
end
2017-04-23 15:27:43 +02:00
compile '/assets/scripts/**/*.js' do
2018-10-20 23:52:17 +02:00
filter :uglify_js, harmony: true if production?
2017-04-23 15:27:43 +02:00
end
2016-08-02 18:31:40 +02:00
ignore '/assets/stylesheets/includes/**/*'
2017-06-14 09:09:37 +02:00
ignore '/data/**/*'
2018-10-14 17:10:53 +02:00
ignore '/node_modules/**/*'
2016-08-02 18:31:40 +02:00
2016-07-23 22:43:46 +02:00
compile '/assets/stylesheets/**/*.scss' do
2018-10-20 23:52:17 +02:00
sass_opts = {
syntax: :scss,
load_paths: ['content/assets/stylesheets']
}
sass_opts[:style] = :compressed if production?
filter :sassc, sass_opts
filter :autoprefixer if production?
2017-03-15 18:32:36 +01:00
write ext: 'css'
2016-07-23 22:43:46 +02:00
end
2018-07-05 11:36:11 +02:00
compile '/assets/stylesheets/**/*.css' do
2018-10-20 23:52:17 +02:00
if production?
filter :rainpress
filter :autoprefixer
end
2018-07-05 11:36:11 +02:00
write ext: 'css'
end
2016-07-23 22:43:46 +02:00
#
#
# ROUTES
#
#
# Google verification file
passthrough '/google6f2e77d0228abc35.html'
2017-03-15 18:32:36 +01:00
route '/**/index.{erb,html,md}' do
"#{item.identifier.without_ext}.html"
2016-07-27 00:13:36 +02:00
end
2016-07-18 09:27:32 +02:00
route '/**/*.{erb,html,md}' do
2017-03-15 18:32:36 +01:00
"#{item.identifier.without_ext}/index.html"
2016-06-09 14:27:23 +02:00
end
2016-12-11 00:55:11 +01:00
# Let anything else simply pass through
passthrough '/**/*'
2016-07-23 22:43:46 +02:00
#
#
# LAYOUTS
#
#
2016-06-09 14:27:23 +02:00
layout '/**/*', :erb