-
Notifications
You must be signed in to change notification settings - Fork 94
/
config.rb
87 lines (68 loc) · 2.32 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# Layouts
require "lib/breaking_source.rb"
require "lib/add_links_to_navigation.rb"
# Tools for generating data
require "lib/navigation_helpers.rb"
require "lib/html_helpers.rb"
require 'lib/doc'
set :encoding, 'utf-8'
set :relative_links, true
# Support for browsing from the build folder.
set :strip_index_file, false
configure :build do
activate :minify_javascript
activate :minify_css
activate :relative_assets
end
set :markdown, :tables => true, :autolink => true, :gh_blockcode => true, :fenced_code_blocks => true, :with_toc_data => true
set :markdown_engine, :redcarpet
set :sass_assets_paths, ['source/shared/sass']
activate :automatic_image_sizes
activate :syntax
activate :sprockets
activate :breaking_source
activate :add_links_to_navigation
helpers NavigationHelpers
helpers HTMLHelpers
configure :development do
activate :livereload
end
helpers do
def asset_data_uri(*args)
asset_url(*args)
end
def shared_partial(*sources)
sources.inject([]) do |combined, source|
# Partials in Middleman 4 are always loaded within the 'source' folder. We have now added a symlink
# of shared resources into it that points to the git submodule at the root of this repo.
# See: https://middlemanapp.com/basics/upgrade-v4/
combined << partial("shared/includes/#{source}",:locals => { :guides => true })
end.join
end
end
after_configuration do
sprockets.append_path "source/shared/img"
sprockets.append_path "source/shared/js"
sprockets.append_path "source/shared/fonts"
sprockets.append_path "source/shared/includes"
sprockets.append_path "source/shared/sass"
end
navigation_data = {
'dsl' => [
{ :name => "podfile", :title => "Podfile Syntax Reference" },
{ :name => "podspec", :title => "Podspec Syntax Reference" },
],
}
# Dynamic pages for documentation, Pod, command line
navigation_data['dsl'].each do |dsl|
name = dsl[:name]
title = dsl[:title]
proxy "syntax/#{name}.html", "templates/dsl.html", {
:locals => { :name => name, :guides_page_browser_title => title, :guides_page_title => title + " <span>v#{Pod::VERSION}</span>", :fullwidth => true },
:ignore => true,
}
end
proxy "terminal/commands.html", "templates/commands.html", {
:locals => { :name => 'commands', :guides_page_title => "Command-line Reference", :fullwidth => true },
:ignore => true,
}