-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathRules
139 lines (109 loc) · 2.58 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
#!/usr/bin/env ruby
require 'sass'
require 'compass'
Compass.add_configuration "#{File.dirname(__FILE__)}/.compass/config.rb"
SITE_ROOT = ""
compile '/assets/*/' do
nil
end
['markup', 'stylesheet', 'background'].each do |ex_file|
compile "/examples/*/#{ex_file}/" do
snapshot :raw
nil
end
end
compile '/' do
filter :haml, :ugly => true
layout item[:layout] ? item[:layout] : "main"
end
compile '/search-data/' do
filter :erb
end
compile '/examples/*/' do
filter :haml, :ugly => true
filter :highlight
layout item[:layout] ? item[:layout] : "example"
end
sass_options = Compass.sass_engine_options
(0..5).each do |i|
compile("/stylesheets/#{'*/' * i}_*/") {nil}
end
compile '/stylesheets/*' do
filter :sass, sass_options.merge(:syntax => item[:extension].to_sym)
end
compile '/reference/*/' do
filter :haml, :ugly => true
filter :highlight
layout item[:layout] ? item[:layout] : "main"
end
compile '/posts/*/' do
filter :erb
filter :rdiscount if item[:extension] == "markdown"
layout 'post'
end
compile "/blog/atom/" do
filter :haml, :attr_wrapper => '"'
end
compile 'sitemap' do
filter :erb
end
compile '*' do
if item[:extension] == "markdown"
filter :erb
filter :rdiscount
elsif item[:extension] == "haml"
filter :haml, :ugly => true
end
layout item[:layout] ? item[:layout] : "main"
end
route 'sitemap' do
item.identifier.chop + '.xml'
end
route "/blog/atom/" do
"/blog/atom.xml"
end
route '/search-data/' do
"#{SITE_ROOT}/javascripts"+item.identifier[0..-2]+".js"
end
(0..5).each do |i|
route("/stylesheets/#{'*/' * i}_*/") {nil}
end
route '/assets/htaccess/' do
"#{SITE_ROOT}/.htaccess"
end
route '/assets/css/*/' do
"#{SITE_ROOT}/stylesheets"+item.identifier.chop[11..-1]
end
route '/assets/images/*/' do
SITE_ROOT+item.identifier.chop[7..-1]
end
route '/assets/javascripts/*/' do
SITE_ROOT+item.identifier.chop[7..-1]
end
route '/assets/fonts/*/' do
SITE_ROOT+item.identifier.chop[7..-1]
end
route '/stylesheets/*/' do
# don't generate a directory like we do for HTML files
SITE_ROOT+item.identifier.chop + '.css'
end
route '/posts/*/' do
if item[:draft]
puts "Skipping Draft post: #{item.identifier}"
nil
elsif item.identifier =~ %r{^/posts/(\d{4})-(\d{2})-(\d{2})-(.*)/$}
"/blog/#{$1}/#{$2}/#{$3}/#{$4}/index.html"
else
puts "WARNING: malformed post name: #{item.identifier}"
nil
end
end
%w(markup stylesheet background).each do |ex_file|
route "/examples/*/#{ex_file}/" do
nil
end
end
route '*' do
SITE_ROOT+item.identifier + 'index.html'
end
layout '*', :haml, :ugly => true