-
-
Notifications
You must be signed in to change notification settings - Fork 156
/
Rules
143 lines (117 loc) · 2.76 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
#!/usr/bin/env ruby
require "compass"
Compass.add_project_configuration('compass_config.rb')
# For compass v0.10 should be:
# Compass.add_configuration "#{File.dirname(__FILE__)}/compass_config.rb"
preprocess do
AutoHelper.new(File.dirname(__FILE__), self).auto
# TODO see https://github.com/nanoc/nanoc/pull/481
# force reload of items, does the damn warning about defining
# preprocess second time - not a problem, no loop here
#self.site.instance_variable_set(:@loaded, false)
#self.site.instance_variable_set(:@items_loaded, false)
#self.site.load
end
compile "/assets/css/*/" do
filter :sass, Compass.sass_engine_options
end
route "/assets/css/_*/" do
nil # don't output partials, so return nil
end
route '/assets/css/*' do
item.identifier.chop.sub(%r{^/assets}, '') + ".css"
end
%w(assets/images assets/javascripts).each do |asset_dir|
compile "/#{asset_dir}/*" do
nil
end
route "/#{asset_dir}/*" do
item.identifier.chop.sub(%r{^/assets}, '') + "." + item[:extension]
end
end
compile '/blog/feed' do
filter :haml
end
route '/blog/feed' do
'/blog/feed.xml'
end
compile '/blog/' do
filter :haml
filter :auto_ids
filter :pre_code
filter :rvm_issues
layout 'default'
end
compile '/blog/*/' do
filter :rdiscount
filter :pre_code
filter :rvm_issues
layout 'blog'
filter :auto_ids
end
# TODO for nanoc 3.8:
# route %r</(authors|tags)/(.*)_feed> do |type,filter|
news_regexp = %r</(authors|tags)/(.*)_feed/>
compile news_regexp do
filter :haml
end
route news_regexp do
type,filter = news_regexp.match(item.identifier).captures
"/#{type}/#{filter}/feed.xml"
end
compile '/(authors|tags)/*/' do
filter :haml
filter :pre_code
layout 'blog'
filter :auto_ids
end
# TODO for nanoc 3.8:
# route %r</blog/([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+)> do |y, m, d, slug|
blog_regexp = %r</blog/([0-9]+)\-([0-9]+)\-([0-9]+)\-([^\/]+)>
route blog_regexp do
y, m, d, slug = blog_regexp.match(item.identifier).captures
"/blog/#{y}/#{m}/#{slug}/index.html"
end
{
"/robots" => "/robots.txt",
"/assets/favicon" => "/favicon.ico",
"/google0e4a57f3096204a2" => "/google0e4a57f3096204a2.html",
"/digicert/verify" => "/digicert/verify.html",
}.each do |file, url|
compile file do
nil
end
route file do
url
end
end
Dir[
"content/license/*.txt",
"content/keybase.txt",
"content/*.asc"
].each do |file|
file = file.gsub(/^content/, "")
path = file.gsub(/\.[^\.]+$/, "")
compile path do
nil
end
route path do
file
end
end
compile '*' do
case
item[:extension]
when 'md'
filter :rdiscount
filter :auto_ids
filter :pre_code
when 'haml'
filter :haml
end
layout "default"
end
route '*' do
item.identifier + "index.html"
end
layout '*', :haml