]> CyberLeo.Net >> Repos - CDN/www.cyberleo.net.git/blob - Rules
Add google webmaster tools ownership file
[CDN/www.cyberleo.net.git] / Rules
1 #!/usr/bin/env ruby
2
3 # A few helpful tips about the Rules file:
4 #
5 # * The string given to #compile and #route are matching patterns for
6 #   identifiers--not for paths. Therefore, you can’t match on extension.
7 #
8 # * The order of rules is important: for each item, only the first matching
9 #   rule is applied.
10 #
11 # * Item identifiers start and end with a slash (e.g. “/about/” for the file
12 #   “content/about.html”). To select all children, grandchildren, … of an
13 #   item, use the pattern “/about/*/”; “/about/*” will also select the parent,
14 #   because “*” matches zero or more characters.
15
16 compile '/stylesheet/' do
17   # don’t filter or layout
18 end
19
20 compile '/googleb33734e827953d88/' do
21 end
22
23 compile '*' do
24   if item.binary?
25     # don’t filter binary items
26     filter :svg2png if item[:extension] == 'svg'
27   else
28     filter :erb
29     layout 'default'
30   end
31 end
32
33 route '/stylesheet/' do
34   '/style.css'
35 end
36
37 route '/googleb33734e827953d88/' do
38   '/googleb33734e827953d88.html'
39 end
40
41 route '*' do
42   if item.binary?
43     # Write item with identifier /foo/ to /foo.ext
44     if item[:extension] == 'svg'
45       # SVGs are transcoded by :svg2png filter
46       item.identifier.chop + '.png'
47     else
48       item.identifier.chop + '.' + item[:extension]
49     end
50   else
51     # Write item with identifier /foo/ to /foo/index.html
52     item.identifier + 'index.html'
53   end
54 end
55
56 layout '*', :erb