forked from couchbaselabs/docs-ng
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rules
executable file
·71 lines (60 loc) · 1.6 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
#!/usr/bin/env ruby
# just copy content in this folder
passthrough '/prebuilt/*'
# Combine and compress all LESS stylesheets to the single file and
# expose it as /assets/css/main.css
compile '/assets/css/main' do
filter :less
filter :yui_compressor, :type => :css
end
route '/assets/css/main' do
"/assets/css/main.css"
end
# Combine all javascripts, enumerated in contents/assets/js/main.erb,
# compress result and expose it as /assets/js/main.js
compile '/assets/js/main' do
filter :erb
filter :yui_compressor, :type => :js
end
route '/assets/js/main' do
"/assets/js/main.js"
end
route '/assets/img/*' do
item.identifier.chop + '.' + item[:extension]
end
route '/assets/root/*' do
"/" + File.basename(item.identifier) + '.' + item[:extension]
end
# All stylesheets and javascripts has been embedded into main.css and
# main.js therefore just skip them for routing and further compilation
compile('/assets/*'){}
route('/assets/*'){}
compile '/index.html' do
layout 'index'
end
compile '*' do
unless item.binary?
case item[:extension]
when 'markdown'
filter :highlight_code
filter :rdiscount, :extensions => [:smart, :autolink]
else
filter :erb
filter :extract_toc, :anchors => true
end
layout 'default'
end
end
route '*' do
if item.binary?
# Write item with identifier /foo/ to /foo.ext
item.identifier.chop + '.' + item[:extension]
else
# Write item with identifier /foo/ to /foo/index.html
item.identifier + 'index.html'
end
end
layout 'navbar_widget', :haml
layout 'version_widget', :haml
layout 'toc_widget', :haml
layout 'default', :erb