-
Notifications
You must be signed in to change notification settings - Fork 18
/
Rules
executable file
·227 lines (202 loc) · 5.56 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
220
221
222
223
224
225
226
227
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# A few helpful tips about the Rules file:
#
# * The string given to #compile and #route are matching patterns for
# identifiers--not for paths. Therefore, you can’t match on extension.
#
# * The order of rules is important: for each item, only the first matching
# rule is applied.
#
# * Item identifiers start and end with a slash (e.g. “/about/” for the file
# “content/about.html”). To select all children, grandchildren, … of an
# item, use the pattern “/about/*/”; “/about/*” will also select the parent,
# because “*” matches zero or more characters.
compile 'sitemap' do
filter :haml
end
route 'sitemap' do
item.identifier.chop + '.xml'
end
compile '/static/*' do
end
compile '/CNAME/' do
end
compile '/api/0.5.0/*' do
filter :erb
filter :kramdown,
:toc_levels => [2,3],
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || '0.5.0'
end
compile '/api/0.6.0/*' do
filter :erb
filter :kramdown,
:toc_levels => [2,3],
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || '0.6.0'
end
compile '/api/0.7.0/*' do
filter :erb
filter :kramdown,
:toc_levels => [2,3],
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || '0.7.0'
end
compile '/api/0.8.0/*' do
filter :erb
filter :kramdown,
:toc_levels => [2,3],
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || '0.8.0'
end
compile '/api/0.9.0/*' do
filter :erb
filter :kramdown,
:toc_levels => [2,3],
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || '0.9.0'
end
compile '/api/0.10.0/*' do
filter :erb
filter :kramdown,
:toc_levels => [2,3],
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || '0.10.0'
end
compile '/api/0.11.0/*' do
filter :erb
filter :kramdown,
:toc_levels => [2,3],
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || '0.11.0'
end
compile '/api/0.12.0/*' do
filter :erb
filter :kramdown,
:toc_levels => [2,3],
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || '0.12.0'
end
compile '/api/0.13.0/*' do
filter :erb
filter :kramdown,
:toc_levels => [2,3],
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || '0.13.0'
end
compile '/api/0.14.0/*' do
filter :erb
filter :kramdown,
:toc_levels => [2,3],
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || '0.14.0'
end
compile '/api/0.15.0/*' do
filter :erb
filter :kramdown,
:toc_levels => [2,3],
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || '0.15.0'
end
compile '/api/*' do
filter :erb
filter :kramdown,
:toc_levels => [2,3],
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || 'api'
end
compile '/guides/*' do
filter :kramdown,
:toc_levels => [2],
:enable_coderay => true,
:coderay_line_numbers => :table,
:coderay_css => :class,
:coderay_bold_every => false
filter :erb
filter :colorize_syntax, :default_colorizer => :pygmentsrb
layout item[:layout] || 'guides'
end
compile '/aboutus/*' do
filter :kramdown, :toc_levels => [2]
filter :erb
filter :colorize_syntax, :default_colorizer => :pygmentsrb
layout item[:layout] || 'aboutus'
end
compile '*' do
if item.binary?
# don’t filter binary items
elsif item[:extension] == 'js'
# don't filter Javascript
else
filter :erb
filter :kramdown,
:enable_coderay => true,
:coderay_line_numbers => nil
filter :colorize_syntax,
:colorizers => {:javascript => :pygmentsrb}
layout item[:layout] || 'default'
end
end
route '/static/*' do
item.identifier[7..-2]
end
route '/CNAME/' do
'/CNAME'
end
route '*' do
if item.binary?
# Write item with identifier /foo/ to /foo.ext
item.identifier.chop + '.' + item[:extension]
elsif item[:extension] == 'js'
# Write item with identifier /foo/ to /foo.js
item.identifier.chop + '.js'
else
# Write item with identifier /foo/ to /foo/index.html
item.identifier + 'index.html'
end
end
compile '/partials/*/' do
end
# Do not route partials, since we plug them into other sources that
# will do the routing.
route '/partials/*/' do
nil
end
layout '*', :erb