-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rules
138 lines (116 loc) · 2.53 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
##!/usr/bin/env ruby
#
#compile '/**/*.html' do
# layout '/default.*'
#end
#
## This is an example rule that matches Markdown (.md) files, and filters them
## using the :kramdown filter. It is commented out by default, because kramdown
## is not bundled with Nanoc or Ruby.
##
##compile '/**/*.md' do
## filter :kramdown
## layout '/default.*'
##end
#
#route '/**/*.{html,md}' do
# if item.identifier =~ '/index.*'
# '/index.html'
# else
# item.identifier.without_ext + '/index.html'
# end
#end
#
#layout '/**/*', :erb
#
ignore '/assets/reveals.js/*.{md,json,html}'
ignore '/assets/reveals.js/node_modules'
ignore '/assets/reveals.js/test'
ignore '/assets/reveals.js/.git'
preprocess do
load_config
paginate_articles
items.select{|item| item[:kind] == 'article'}.each{|item| item[:menu_item] = 'News' }
fix_author_list
end
compile '/assets/**/*' do
end
compile '/**/slides/**.{md,html}' do
puts "compiling #{item.identifier.to_s}"
if item.identifier.to_s.end_with? '.md'
filter :kramdown
else
filter :erb
end
layout '/reveal_slides.*'
end
compile '/{news}/**/*.{html,md}' do
puts "compiling #{item.identifier.to_s}"
# Allow some articles to be in markdown
if item.identifier.to_s.end_with? '.md'
filter :kramdown
else
filter :erb
end
if item[:kind] == 'article'
layout '/blog_article.*'
else
layout '/blog_pagination.*'
end
end
compile '/news/**/*' do
filter :erb
layout '/blog_pagination.*'
end
compile '**/*.{md,htm,html}' do
puts "compiling #{item.identifier.to_s}"
if item.identifier.to_s.end_with? '.md'
filter :kramdown
puts "#{item.identifier} compiled with :kramdown"
else
filter :erb
end
layout '/page.*'
end
compile '/work/**/*' do
layout '/page.*'
filter :erb
end
compile '**/*' do
if item.binary?
# don’t filter binary items
else
begin
filter :erb
layout '/default.*'
rescue => details
puts "Exception while compiling " + item.identifier
raise details
end
end
end
passthrough '/assets/**/*'
route '/assets/**/*' do
# /static/foo.html → /foo.html
item.identifier.to_s.sub(/\A\/static/, '')
end
route '/**/*.{html,md}' do
if item.identifier =~ '/index.*'
'/index.html'
else
item.identifier.without_ext + '/index.html'
end
end
route '**/*' do
if item.binary?
# Write item with identifier /foo/ to /foo.ext
#item.identifier.chop + '.' + item[:extension]
item.identifier.to_s
else
# Write item with identifier /foo/ to /foo/index.html
item.identifier + 'index.html'
end
end
layout '/blog_pagination.*', :erb
layout '/publications_list.*', :erb
layout '/**/*', :erb