-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRules
58 lines (48 loc) · 1.22 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
#!/usr/bin/env ruby
preprocess do
@items.each do |item|
if item.identifier =~ '/posts/*.md'
item[:kind] = "article"
elsif item.identifier =~ '/posts/*.org'
item[:kind] = "article"
item[:title], item[:author], item[:created_at] = parse_org_in_buffer_settings('./content' + item.identifier)
end
end
end
compile '/feed.xml' do
filter :erb
write item.identifier.to_s
end
compile '/**/*.html' do
filter :erb
layout '/default.*'
end
route '/**/*.html' do
if item.identifier =~ '/index.*'
'/index.html'
else
item.identifier.without_ext + '/index.html'
end
end
compile '/posts/*.md' do
filter :kramdown, auto_ids: false, enable_coderay: false
filter :google_code_prettify_kramdown
layout '/post.*'
end
compile '/posts/*.org' do
filter :pandoc, args: [{ from: :org, to: :html, wrap: :none }]
filter :google_code_prettify_pandoc
layout '/post.*'
end
route '/posts/*.{md,org}' do
time = attribute_to_time(item[:created_at])
slug = File.basename(item.identifier, ".*")
time.strftime("/%Y/%m/%d/") + slug + "/index.html"
end
compile '/posts/*.png' do
write "/" + File.basename(item.identifier.to_s)
end
compile '/**/*' do
write item.identifier.to_s
end
layout '/**/*', :erb