-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathRules
executable file
·100 lines (82 loc) · 2.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
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
#!/usr/bin/env ruby
# frozen_string_literal: true
preprocess do
config[:nanoc_version_info] = Nanoc::Core.version_information.strip
config[:nanoc_version_info_major_minor] = Nanoc::Core.version_information.strip.scan(/\d+/).take(2).join('.')
config[:nanoc_version_info_major] = Nanoc::Core.version_information.strip.scan(/\d+/).first
config[:gem_version_info] = Gem::VERSION
config[:ruby_version_info] = `ruby --version`.strip
end
layout '/**/*', :erb
passthrough '/_redirects'
ignore '/**/_*'
passthrough '/favicon.ico'
ignore '/assets/style/*.tex'
compile '/well-known/**/*' do
write '/.' + item.identifier.to_s[1..-1]
end
compile '/assets/images/hero/*' do
write item.identifier.without_ext + '-' + fingerprint('/assets/images/hero/*') + '.' + item.identifier.ext
end
passthrough '/assets/images/**/*'
compile '/assets/style/*' do
filter :dart_sass
filter :relativize_paths, type: :css
filter :rainpress
write item.identifier.without_ext + '-' + fingerprint('/assets/style/*') + '.css'
end
compile '/sitemap.xml.*' do
filter :erb
write '/sitemap.xml'
end
compile '/robots.*' do
filter :erb
write '/robots.txt'
end
compile '/index.*' do
filter :erb
layout '/default.*'
filter :relativize_paths, type: :html
filter :cleanup_meta_charset
write '/index.html'
end
compile '/404.*' do
filter :dmark2html
layout '/default.*'
filter :cleanup_meta_charset
write '/404.html'
end
compile '/release-notes.*' do
filter :fix_contributor_brackets
filter :kramdown, auto_ids: false
filter :add_ids_to_headers
filter :autolink_github_gitlab
layout '/default.*'
filter :add_toc
filter :relativize_paths, type: :html
filter :cleanup_meta_charset
write item.identifier.without_ext + '/index.html'
end
compile '/**/*' do
case item.identifier.ext
when 'erb'
filter :erb
filter :add_ids_to_headers
when 'dmark'
filter :dmark2html
else
filter :add_ids_to_headers
end
layout '/default.*'
filter :add_toc
filter :relativize_paths, type: :html
filter :cleanup_meta_charset
if item.binary?
write item.identifier.to_s
elsif item.identifier =~ '/doc/about.*'
# TODO: Remove me, and set up a redirect from /about to /doc/about
write '/about/index.html'
else
write item.identifier.without_ext + '/index.html'
end
end