zeus.ugent.be/Rules

255 lines
3.9 KiB
Plaintext
Raw Permalink Normal View History

2016-06-09 12:27:23 +00:00
#!/usr/bin/env ruby
2016-07-19 06:39:52 +00:00
# frozen_string_literal: true
2016-06-09 12:27:23 +00:00
2016-07-20 12:38:50 +00:00
require 'json'
2016-07-26 22:13:36 +00:00
require 'icalendar'
2016-07-20 12:38:50 +00:00
2021-02-26 14:24:40 +00:00
2019-09-26 14:39:25 +00:00
# Important!!!
# First ignore the node_modules, we do not need any of it on the site directly.
ignore '/node_modules/**/*'
2016-07-23 20:43:46 +00:00
#
#
# PREPROCESS
#
#
2019-09-26 14:39:25 +00:00
2016-07-20 12:38:50 +00:00
preprocess do
2018-10-14 15:10:53 +00:00
`yarn`
# We don't want to compile old blogposts in development
ignore_old_content('blog', 'events', 'about/verslagen') if development?
2016-12-10 23:55:11 +00:00
update_blog_attributes
create_yearly_items('Blog')
create_yearly_items('Events')
2020-10-12 17:40:15 +00:00
create_tagly_items('Blog')
create_tagly_items('Events')
2016-12-10 23:55:11 +00:00
convert_event_time_to_timestamps
2018-03-01 15:33:12 +00:00
all_events.each do |event|
check_schema(:event, event)
end
2019-12-10 22:09:15 +00:00
all_privacy_items.each do |project|
check_schema(:privacy, project)
end
2018-02-25 19:29:35 +00:00
add_report_metadata
add_project_metadata
convert_locations
2016-07-20 12:38:50 +00:00
end
2016-07-23 20:43:46 +00:00
#
#
# COMPILATION
#
#
2017-05-29 12:36:20 +00:00
compile '/*.xml' do
2016-07-26 18:08:42 +00:00
filter :erb
end
2016-07-23 20:43:46 +00:00
#
# ARCHIVES
#
2016-09-22 19:23:40 +00:00
compile '/blog/*' do
layout '/blogs.*'
2016-07-23 19:17:24 +00:00
layout '/generic.*'
layout '/default.*'
2016-07-19 08:27:27 +00:00
filter :erb
2018-10-14 15:10:53 +00:00
filter :html_press if production?
2016-06-09 12:27:23 +00:00
end
2016-07-23 20:43:46 +00:00
#
2016-08-23 18:21:02 +00:00
# EVENTS
2016-07-23 20:43:46 +00:00
#
# Overview page
compile '/events/*' do
layout '/events.*'
layout '/generic.*'
layout '/default.*'
filter :erb
2018-10-14 15:10:53 +00:00
filter :html_press if production?
end
compile '/events/*/*' do
filter :erb
2016-06-09 13:04:10 +00:00
filter :kramdown
2016-07-18 07:24:24 +00:00
2016-07-19 08:27:27 +00:00
layout '/eventpost.*'
layout '/default.*'
2016-07-12 21:58:08 +00:00
filter :erb
2018-10-14 15:10:53 +00:00
filter :html_press if production?
2016-06-09 13:04:10 +00:00
end
2016-06-09 12:27:23 +00:00
compile '/events/*/*', rep: :text do
2016-07-20 15:52:56 +00:00
filter :kramdown
filter :strip_html
end
compile '/events/*/*', rep: :ical do
2016-07-26 22:13:36 +00:00
filter :ical
2017-03-15 17:32:36 +00:00
write ext: 'ics'
2016-07-26 22:13:36 +00:00
end
2016-08-23 18:21:02 +00:00
#
# POSTS
#
2018-03-10 10:14:36 +00:00
compile '/blog/*/*.md' do
filter :erb
2016-10-31 11:29:44 +00:00
layout '/blogpost.md'
2021-02-26 14:24:40 +00:00
filter :kramdown, {math_engine: :katex}
2018-04-10 09:59:20 +00:00
filter :typogruby
2016-08-23 18:21:02 +00:00
2016-10-31 11:29:44 +00:00
layout '/blogpost.erb'
2016-08-23 18:21:02 +00:00
layout '/generic.*'
layout '/default.*'
2016-12-29 12:37:22 +00:00
filter :erb
2018-03-08 21:44:19 +00:00
2018-10-14 15:10:53 +00:00
filter :html_press if production?
2016-08-23 18:21:02 +00:00
end
2018-03-10 10:14:36 +00:00
compile '/blog/*/*.md', rep: :text do
2018-04-13 09:22:02 +00:00
filter :erb
2016-08-23 18:21:02 +00:00
filter :kramdown
filter :strip_html
end
2018-03-10 10:14:36 +00:00
compile '/blog/*/*.md', rep: :html do
2018-04-13 09:22:02 +00:00
filter :erb
2017-10-11 16:26:02 +00:00
filter :kramdown
end
2016-10-03 19:56:08 +00:00
#
# PROJECTS
#
compile '/projects/*' do
filter :kramdown
2018-03-10 10:14:36 +00:00
2018-02-25 19:29:35 +00:00
# Don't write out the projects themselves for now
write nil
2016-10-03 19:56:08 +00:00
end
2016-10-04 14:25:03 +00:00
compile '/*_search.json' do
2016-07-24 11:09:37 +00:00
filter :erb
end
2016-08-04 18:57:25 +00:00
compile '/**/*.ics' do
2016-07-26 22:13:36 +00:00
filter :erb
end
2019-11-27 13:30:30 +00:00
#
# PRIVACY
#
2019-12-10 20:34:33 +00:00
compile '/about/privacy/*' do
2019-11-27 13:30:30 +00:00
filter :kramdown
# Don't write out the privacy items themselves for now
nil
end
2018-02-25 19:29:35 +00:00
#
# REPORTS
#
# Note drive/verslagen is 'linked' as a data source to /about/verslagen/
2018-02-25 19:29:35 +00:00
compile '/about/verslagen/*/*.md', rep: :pdf do
2020-11-16 18:10:58 +00:00
filter :pandoc_pdf, args: { f: :markdown, 'pdf-engine': 'xelatex', template: 'templates/report.tex' } if production?
2018-10-14 15:44:01 +00:00
write ext: (production? ? 'pdf' : 'md')
2018-02-25 19:29:35 +00:00
end
2017-05-29 12:36:20 +00:00
#
# GENERIC ERB PAGES
#
2016-11-01 16:11:51 +00:00
compile '/**/*.erb' do
2017-04-23 13:32:18 +00:00
filter :erb
# Apply typographic improvements if required by the page. Use this on text-heavy pages,
2019-08-29 11:01:57 +00:00
# such as the history page.
if @item[:typography]
filter :typogruby
end
2016-07-23 20:06:06 +00:00
layout '/generic.*'
layout '/default.*'
2018-10-14 15:10:53 +00:00
filter :html_press if production?
2016-07-23 20:06:06 +00:00
end
2017-05-29 20:34:09 +00:00
compile '/**/*.md' do
filter :erb
filter :kramdown
2017-06-14 07:09:37 +00:00
2017-05-29 20:34:09 +00:00
layout '/generic.*'
layout '/default.*'
end
2016-07-23 20:43:46 +00:00
#
# ASSETS
#
2017-04-23 13:27:43 +00:00
compile '/assets/scripts/**/*.js' do
2018-10-20 21:52:17 +00:00
filter :uglify_js, harmony: true if production?
2017-04-23 13:27:43 +00:00
end
2016-08-02 16:31:40 +00:00
ignore '/assets/stylesheets/includes/**/*'
2017-06-14 07:09:37 +00:00
ignore '/data/**/*'
2016-08-02 16:31:40 +00:00
2016-07-23 20:43:46 +00:00
compile '/assets/stylesheets/**/*.scss' do
2018-10-20 21:52:17 +00: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 17:32:36 +00:00
write ext: 'css'
2016-07-23 20:43:46 +00:00
end
2018-07-05 09:36:11 +00:00
compile '/assets/stylesheets/**/*.css' do
2018-10-20 21:52:17 +00:00
if production?
filter :rainpress
filter :autoprefixer
end
2018-07-05 09:36:11 +00:00
write ext: 'css'
end
2016-07-23 20:43:46 +00:00
#
#
# ROUTES
#
#
# Google verification file
passthrough '/google6f2e77d0228abc35.html'
2017-03-15 17:32:36 +00:00
route '/**/index.{erb,html,md}' do
"#{item.identifier.without_ext}.html"
2016-07-26 22:13:36 +00:00
end
2016-07-18 07:27:32 +00:00
route '/**/*.{erb,html,md}' do
2017-03-15 17:32:36 +00:00
"#{item.identifier.without_ext}/index.html"
2016-06-09 12:27:23 +00:00
end
2020-11-17 04:08:03 +00:00
route %r[/well-known/(.+)] do |rest|
"/.well-known/" + rest[0]
end
2016-12-10 23:55:11 +00:00
# Let anything else simply pass through
passthrough '/**/*'
2016-07-23 20:43:46 +00:00
#
#
# LAYOUTS
#
#
2016-06-09 12:27:23 +00:00
layout '/**/*', :erb