This repository has been archived by the owner on Nov 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathconfig.rb
72 lines (59 loc) · 1.63 KB
/
config.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
require 'lib/gfm_ids.rb'
activate :deploy do |deploy|
deploy.deploy_method = :git
end
activate :bh
set :css_dir, 'stylesheets'
set :js_dir, 'javascripts'
set :images_dir, 'images'
config[:sass_assets_paths] << Bootstrap.stylesheets_path
# Build-specific configuration
configure :build do
activate :minify_css
activate :minify_javascript
activate :asset_hash # Cache Buster
# Asset pipeline
activate :sprockets do |c|
c.expose_middleman_helpers = true
end
end
configure :development do
activate :livereload
end
set :markdown, { fenced_code_blocks: true, with_toc_data: true }
set :markdown_engine, :redcarpet
activate :syntax
activate :gfm_ids
Dir['api-blueprint/examples/*.md']
.map do |path|
path = Pathname.new(path)
title = path.basename.sub_ext('').to_s
slug = title.gsub('.', '').gsub(' ', '-').downcase
{
title: title,
slug: slug,
path: path,
content: path.read
.split("\n")
.reject do |line|
# Remove the interlinking
line == '## API Blueprint' || line.start_with?('+ [Previous:') || line.start_with?('+ [This:') || line.start_with?('+ [Next:')
end
.join("\n"),
}
end
.reject { |example| example[:title] == 'README' }
.each do |example|
proxy "/documentation/examples/#{example[:slug]}.html", "/documentation/examples/example.html", :locals => example
end
ignore '/documentation/examples/example.html'
helpers do
def include(path)
print("[debug] " + path)
IO.read(path).sub(/^#[ \w].+$/, '')
end
# Returns all of the available tool tags
def tool_tags
data.tools.map(&:tags).flatten.uniq
end
end