forked from mgutz/nanoc3_blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRules
62 lines (49 loc) · 1.28 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
#!/usr/bin/env ruby
preprocess do
# authors may unpublish items by setting meta attribute publish: false
items.delete_if { |item| item[:publish] == false }
copy_static
create_tag_pages
add_update_item_attributes
# create tag cloud http://pastie.org/599853
cc = render('_tag_cloud', :items => items)
items.each do |item|
if not item[:cloudcode]
item[:cloudcode] = cc
end
end
end
compile '/css/*/' do
end
compile '*' do
# item[:extension] returns 'html.erb' for multi-dotted filename
ext = item[:extension].nil? ? nil : item[:extension].split('.').last
if ext == 'erb'
filter :erubis
elsif ext == 'cr'
filter :wikicreole
elsif ext == 'haml' || ext.nil?
filter :haml
elsif ext == 'md' || ext == 'markdown'
filter :erubis
filter :rdiscount
else
raise "Filter is not configured for #{item.identifier} in Rules file."
end
# use layouts with .html extension or layout specified in meta
item[:layout] = "none" unless item[:layout] || File.extname(route_path(item)) == '.html'
layout 'default' unless item[:layout] == "none"
end
route '/tags/*/' do
item.identifier.chop + '.html'
end
route '/sticky/' do
nil
end
route '/css/*/' do
item.identifier.chop + '.css'
end
route '*' do
route_path(item)
end
layout '*', :erubis