This repository has been archived by the owner on Dec 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rules
219 lines (174 loc) · 4.8 KB
/
Rules
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#!/usr/bin/env ruby
# frozen_string_literal: true
preprocess do
jaren.each do |item|
jaar = item.identifier.without_ext.split('/').last.to_i
item[:jaar] = jaar
end
@items.find_all('/studentvillage/**/*.md').each do |sv|
raise "SV item has no name! #{sv.identifier}" unless sv[:name]
sv[:naam] = sv[:name]
end
@items.find_all('/artists/**/*.md').each do |artist|
split_s = artist.identifier.without_ext.split('/')
# Extract the three last elements
*_, edition, stage, ident = *split_s
unless artist[:start].blank? || artist[:end].blank?
artist[:start] = DateTime.parse(artist[:start] + '+0200')
artist[:end] = DateTime.parse(artist[:end] + '+0200')
end
artist[:title] = artist[:name]
artist[:stage] = stage
# Set artist image, with a default
if artist[:image]
artist[:image] = "/assets/images/artists/#{edition}/#{artist[:image]}"
else
artist[:image] = "/assets/images/artists/#{edition}/#{ident}.jpg"
end
unless File.exists?("content/" + artist[:image])
artist[:image] = ""
end
end
crew_years.each do |year|
@items.create('', { year: year }, "/crew/#{year}.erb")
crew_of(year).each do |crew|
crew[:year] = year
end
end
def symbolize(x)
case x
when Hash
x.symbolize_keys!
x.each { |_, v| symbolize(v) }
when Enumerable
x.each { |v| symbolize(v) }
end
end
# We want these items to populate the attributes as well
@items.find_all('/**/*.yml').each do |i|
i.update_attributes(symbolize(YAML.safe_load(i.raw_content)))
end
# Add extra attributes to our crewmembers
@items['/**/leden.*'][:leden].each do |e|
e[:email] = e[:naam].downcase.tr(' ', '.')
end
@items.find_all('/crew/*/*.md').each do |i|
next unless i.attributes[:teamleden]
i.attributes[:teamleden].map! do |e|
e.merge!(crew_map[e[:naam]]) if crew_map[e[:naam]]
# Don't infer photo name when provided
unless e[:photo]
compact_name = ActiveSupport::Inflector.transliterate(
e[:naam].downcase.gsub(/[-' ]/, '')
)
e[:photo] = "#{compact_name}.jpg"
end
# Set the photo url dependent on year
e[:photo] = "members/#{e[:photo]}"
e
end
end
end
compile '/historiek/*.md' do
filter :kramdown
end
compile '/goededoelen/*.md' do
filter :kramdown
end
compile '/crew/*/*.md' do
filter :kramdown
layout '/crew/teampagina.*'
layout '/default.*'
filter :erb
end
compile '/crew/*.erb' do
filter :erb
layout '/crew/overview.*'
layout '/default.*'
end
compile '/**/*.md' do
filter :kramdown
layout '/default.*'
filter :erb
end
compile '/artists/**/*.md' do
filter :kramdown
layout '/artist_page.*'
layout '/default.*'
filter :erb
end
compile '/artists/**/*.md', rep: :json do
filter :kramdown
filter :strip_html
filter :json, item.attributes.merge(
image: "https://studentkickoff.be#{item[:image]}"
)
end
ignore '/studentvillage/**/*.md'
compile '/studentvillage/**/*.md', rep: :json do
filter :kramdown
filter :strip_html
attrs = item.attributes.dup
attrs[:logo] &&= "https://studentkickoff.be/assets/images/studentvillage/#{attrs[:logo]}"
filter :json, attrs
end
compile '/**/*.erb' do
layout '/default.*'
filter :erb
end
compile '/**/*.json' do
filter :erb
write item.identifier.to_s
end
compile '/assets/images/gallery/*.{jpg,png}', rep: :thumbnail do
filter :img_resize, size: '150x150'
# filter :img_compress
write "#{item.identifier.without_ext}_thumbnail.jpg"
end
compile '/assets/images/org/*/members/*.{jpg,png}' do
filter :img_resize, size: '300x300'
end
compile '/assets/images/org/*/team*.{jpg,png}' do
filter :img_resize, size: '1920x1080'
end
compile '/assets/images/artists/**/*.{jpg,png}' do
filter :img_resize, size: '400x400'
end
compile '/assets/images/**/*.{jpg,png}' do
# filter :img_compress
end
# Empty route blocks prevent items from being written out
route '/historiek/*.md' do; end
route '/goededoelen/*.md' do; end
route '/artists/*/*.md' do
split_path = @item.identifier.without_ext.split('/')
split_path.delete_at(-2)
"#{split_path.join('/')}/index.html"
end
route '/**/*.{erb,html,md}' do
if item.identifier =~ '/index.*'
'/index.html'
else
"#{item.identifier.without_ext}/index.html"
end
end
ignore '/assets/stylesheets/includes/**/*'
compile '/**/*.scss' do
filter :sass, syntax: :scss
filter :autoprefixer
write ext: 'css'
end
compile '/**/*.coffee' do
filter :erb
filter :coffeescript
write ext: 'js'
end
passthrough '/assets/**/*'
passthrough '/crew/leden.yml'
passthrough '/signature/logo2013.png'
passthrough '**/*'
layout '/**/*', :erb
# TODO: Clean up this hot mess
postprocess do
File.rename('output/assets/stylesheets/layout.css', 'output'+cache_busted_path('/assets/stylesheets/layout.scss'))
end