-
Notifications
You must be signed in to change notification settings - Fork 10
/
Rules
129 lines (110 loc) · 2.42 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
#!/usr/bin/env ruby
preprocess do
expand_event_list("/_data/chaosevents/")
expand_event_list("/_data/stammtisch/", "CCCS Stammtisch")
expand_event_list("/_data/platzhalter/", nil, true)
calculate_to_dates
fix_timezones
merge_location_data
generate_event_pages
generate_activity_pages
generate_archive_pages
generate_twitter_archive_pages
end
compile %r{/_} do
nil
end
compile '/styles/*' do
if item[:extension]=="scss" && !item.identifier.split("/")[-1].start_with?("_")
filter :sass, {
:load_paths => ["#{Dir.pwd}/content/styles", "#{Dir.pwd}/bootstrap-sass/vendor/assets/stylesheets"],
:syntax => :scss,
:style => :compact
#:style => :compressed
}
end
end
compile "/ical" do
filter :erb
end
compile "/htaccess" do
filter :erb
end
compile "/robots" do
nil
end
compile "atom" do
filter :erb
end
compile '*' do
item_name = if item.identifier=="/"
""
else
item.identifier.split("/")[-1]
end
if item.binary? or item[:extension]=='txt'
# don’t filter binary items
else
case item[:extension]
when 'md','markdown' then
filter :rdiscount, { :extensions => [ :smart ] }
end
filter :erb
if item_name.start_with?("_") or item[:kind]=='member'
nil
else
if item[:style]!='none'
#layout 'default'
layout item[:style] || 'default'
end
end
end
end
route %r{/_} do
nil
end
route '/static/*' do
item.identifier[7..-2]
end
route '/styles/*' do
item.identifier.chop + '.css'
end
route "/ical" do
"/cccs.ical"
end
route "/htaccess" do
"/.htaccess"
end
route "/robots" do
item.identifier.chop + '.txt'
end
route "/atom" do
item.identifier.chop + '.xml'
end
route '/articles/*' do
# Find corresponding article (for getting metadata)
articleitem = article_base_item(item)
if articleitem
# Create directory basename
url = '/' + pathname_of_article(articleitem)
# Main article goes to index.html, don't touch other filenames
if item.equal? articleitem then
url + '/index.html'
else
idparts = item.identifier.split('/')
url + "/#{idparts.last}.#{item[:extension]}"
end
else
nil
end
end
route '*' do
if item[:kind]=='member'
nil
elsif item.binary? or item[:extension]=='txt'
item.identifier.chop + '.' + item[:extension]
else
item.identifier.chop + '/index.html'
end
end
layout '*', :erb