blob: add701a8fcd8f44812c4638871f5cbd2e4f3d228 (
plain)
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
|
#!/usr/bin/env ruby
preprocess do
@items.each do |item|
if item.identifier.to_s.end_with?(".md") && !item.binary?
begin
title = item.raw_content.match(/^[#] .*$/s).to_s
title.gsub!('# ', '')
item[:title] = title
# Encoding errors happen on some files for some reason, so we
# rescue them.
rescue Encoding::CompatibilityError
puts "Encoding error"
end
end
end
end
compile '/**/*.html' do
layout '/default.*'
end
compile '/**/*.md' do
filter :kramdown,
input: 'GFM',
syntax_highlighter: 'rouge',
hard_wrap: false
layout '/default.*'
filter :md_to_html_ext
filter :edit_on_gitlab_link
end
compile '/**/*.scss' do
filter :sass, syntax: :scss
write item.identifier.without_ext + '.css'
end
compile '/index.*' do
filter :erb
layout '/home.*'
write '/index.html'
end
compile '/sitemap.*' do
filter :erb
write '/sitemap.xml'
end
compile '/robots.*' do
filter :erb
write '/robots.txt'
end
route '/**/*.scss' do
item.identifier.without_ext + '.css'
end
route '/**/*.{html,md}' do
if item.identifier =~ '/index.*'
'/index.html'
else
item.identifier.without_ext + '.html'
end
end
compile '/**/*' do
unless item.identifier.ext == 'scss'
write item.identifier.to_s
end
end
# Leave the favicon alone.
passthrough '/favicon.ico'
# Let's Encrypt challenge.
passthrough '/.well-known/**/*'
layout '/**/*', :erb
|