-
Notifications
You must be signed in to change notification settings - Fork 1
/
rules.rb
86 lines (76 loc) · 1.8 KB
/
rules.rb
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
# -*- encoding : utf-8 -*-
preprocess do
# setup blog items
all_feeds.each do |feed|
feed.chain_entries
feed.set_info
feed.generate
end
# sitemap
hide_items do |item|
case item.identifier
when %r{/publications/\d\d\d\d/.*}
false
when /404|500|htaccess/, %r{/(scripts|stylesheets)/.*}
true
else
item.binary? || @site.config[:hidden_extensions].include?(item[:extension])
end
end
create_sitemap
end
layout '*', :by_extension,
haml: { format: :xhtml, ugly: true }
# do not generate partials, Sass includes, etc
ignore %r{/(_|README)}
# publications list from bibliography
compile '/publications/DamienPollet/', rep: :html do
filter :external,
cmd: [ 'bibhtmlize/bibhtmlize', item[:content_filename] ],
pipe_content: false
end
route '/publications/DamienPollet/', rep: :html do nil end
# blog articles
compile %r{/notes/\d\d\d\d/.*/} do
case item[:extension]
when 'html', 'markdown'
filter :erb
filter :kramdown
filter :rubypants
layout 'article'
filter :relativize_paths, type: :html
end
end
# default pipeline & routing
compile '*' do
case item[:extension]
when 'bib'
# TODO filter out the BibDesk noise
when /(.+\.)?js/
# filter :closure_compiler
when 'sass'
filter :sass, style: :compact
filter :relativize_paths, type: :css
when 'erb', 'html', 'markdown'
filter :erb
filter :kramdown unless item[:extension] == 'erb'
filter :rubypants
layout 'default'
filter :relativize_paths, type: :html
when 'feed', 'xml'
filter :erb
# filter :relativize_paths, type: :xml
end
end
route '*' do
case item[:extension]
when 'sass'
extension 'css'
when 'erb', 'html', 'markdown'
extension 'html', as_index: true
when 'feed'
extension 'xml'
else
extension
end
end