forked from cerner/fhir.cerner.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rules
73 lines (60 loc) · 1.83 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
# frozen_string_literal: true
#!/usr/bin/env ruby
# The Rules file contains the processing instructions for all items in a Nanoc site.
# Three different kinds of rules exist:
# http://nanoc.ws/doc/rules/
# http://nanoc.ws/doc/identifiers-and-patterns/
#
# compilation rules
# These rules describe the actions that should be executed during compilation
# (filtering, layouting, and snapshotting).
# routing rules
# These rules describe the path where the compiled items should be written to.
# layouting rules
# These rules describe the filter that should be used for a given layout.
#
# For every item, Nanoc finds the first matching compilation rule. Similarly, for every layout, Nanoc finds the first
# matching layouting rule. The first matching rule that is found in the rules file is used.
#
# If an item or a layout is not using the correct rule, double-check to make sure that the rules
# are in the correct order.
preprocess do
add_version_attribute
add_solution_attribute
RedirectGenerator.generate(config[:redirects], @items)
end
compile '/CNAME.*' do
end
compile '/static/**/*' do
end
compile '/**/faq.*' do
filter :erb
filter :kramdown, toc_levels: [2]
layout '/faq.*'
filter :relativize_paths, type: :css
filter :relativize_paths, type: :html
end
compile '/**/*' do
filter :erb
filter :kramdown, toc_levels: [2, 3]
layout item[:layout] ? "/#{item[:layout]}.*" : '/api.*'
filter :relativize_paths, type: :css
filter :relativize_paths, type: :html
end
route '/static/**/*' do
# /static/foo.html -> /foo.html
item.identifier.to_s.sub(%r{\A/static}, '')
end
route '/CNAME.*' do
item.identifier.chop
end
route '/index.md' do
'/index.html'
end
route '/**/*' do
item.identifier.without_ext + '/index.html'
end
route '/**/index.*' do
item.identifier.without_ext + '.html'
end
layout '/**/*', :erb