swedbank-pay-design-guide-jekyll-theme 1.8.1 → 1.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/_includes/iterator.html +2 -2
- data/_includes/title-header.html +32 -0
- data/_layouts/default.html +13 -32
- data/_layouts/front-page.html +24 -21
- data/_plugins/sidebar.rb +2 -1
- data/_sass/breakpoints.scss +5 -0
- data/_sass/card.scss +1 -0
- data/_sass/front-page.scss +108 -71
- data/_sass/sidebar.scss +33 -3
- data/_sass/swedbank-pay-design-guide-theme.scss +5 -0
- data/_sass/title-header.scss +3 -0
- data/_sass/variables.scss +1 -1
- data/assets/css/pygments-autumn.css +1 -1
- data/lib/gem_version.rb +1 -1
- data/lib/safe_merge.rb +28 -0
- data/lib/sanitized_filename.rb +12 -0
- data/lib/sidebar.rb +23 -196
- data/lib/sidebar_html_builder.rb +154 -0
- data/lib/sidebar_page.rb +181 -0
- data/lib/sidebar_page_collection.rb +36 -0
- data/lib/sidebar_page_title.rb +94 -0
- data/lib/sidebar_parser.rb +95 -0
- data/lib/sidebar_path.rb +62 -0
- data/lib/sidebar_renderer.rb +67 -0
- data/lib/sidebar_text_builder.rb +47 -0
- data/lib/sidebar_tree_builder.rb +86 -0
- metadata +31 -4
data/_sass/sidebar.scss
CHANGED
@@ -6,14 +6,13 @@
|
|
6
6
|
display: flex;
|
7
7
|
flex-direction: column;
|
8
8
|
align-items: center;
|
9
|
-
margin-bottom: 2.5rem;
|
10
9
|
margin-top: 2rem;
|
11
10
|
text-decoration: none;
|
12
11
|
color: #512b2b;
|
13
12
|
|
14
13
|
img {
|
15
|
-
|
16
|
-
margin-
|
14
|
+
margin-top: 1.5rem;
|
15
|
+
margin-bottom: 1.25rem;
|
17
16
|
}
|
18
17
|
|
19
18
|
span {
|
@@ -30,6 +29,37 @@
|
|
30
29
|
}
|
31
30
|
}
|
32
31
|
|
32
|
+
.search-container {
|
33
|
+
box-shadow: 1px 2px 10px rgba(0, 0, 0, 0.15);
|
34
|
+
border-radius: 0.125rem;
|
35
|
+
|
36
|
+
&:focus-within {
|
37
|
+
outline: -webkit-focus-ring-color auto 0.5px;
|
38
|
+
}
|
39
|
+
|
40
|
+
.search-input {
|
41
|
+
color: $medium-brown;
|
42
|
+
font-size: 0.875rem;
|
43
|
+
border: none;
|
44
|
+
padding: 0.375rem;
|
45
|
+
|
46
|
+
&:focus {
|
47
|
+
color: $brown;
|
48
|
+
outline: none
|
49
|
+
}
|
50
|
+
}
|
51
|
+
|
52
|
+
i {
|
53
|
+
display: block;
|
54
|
+
color: $brown;
|
55
|
+
|
56
|
+
&:hover {
|
57
|
+
color: $turquoise-link;
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
}
|
62
|
+
|
33
63
|
.main-nav-ul {
|
34
64
|
.nav-group {
|
35
65
|
.nav-ul {
|
@@ -1,6 +1,7 @@
|
|
1
1
|
@import 'colors.scss';
|
2
2
|
@import 'fonts.scss';
|
3
3
|
@import 'variables.scss';
|
4
|
+
@import 'breakpoints.scss';
|
4
5
|
|
5
6
|
@import 'card.scss';
|
6
7
|
@import 'code-view.scss';
|
@@ -17,6 +18,10 @@ img {
|
|
17
18
|
max-width: 100%;
|
18
19
|
}
|
19
20
|
|
21
|
+
body {
|
22
|
+
font-size: 1.125rem;
|
23
|
+
}
|
24
|
+
|
20
25
|
.table {
|
21
26
|
|
22
27
|
th,
|
data/_sass/title-header.scss
CHANGED
data/_sass/variables.scss
CHANGED
@@ -1 +1 @@
|
|
1
|
-
$max-width:
|
1
|
+
$max-width: 880px;
|
@@ -36,7 +36,7 @@
|
|
36
36
|
.highlight .nf { color: #00aa00 } /* Name.Function */
|
37
37
|
.highlight .nn { color: #00aaaa; text-decoration: underline } /* Name.Namespace */
|
38
38
|
.highlight .nt { color: #1e90ff; font-weight: bold } /* Name.Tag */
|
39
|
-
.highlight .nv { color: #
|
39
|
+
.highlight .nv { color: #e07088 } /* Name.Variable */
|
40
40
|
.highlight .ow { color: #0000aa } /* Operator.Word */
|
41
41
|
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
|
42
42
|
.highlight .mb { color: #009999 } /* Literal.Number.Bin */
|
data/lib/gem_version.rb
CHANGED
data/lib/safe_merge.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The Hash class
|
4
|
+
class Hash
|
5
|
+
# Safely merges the current Hash with an 'other' Hash.
|
6
|
+
def safe_merge(other)
|
7
|
+
all_keys = keys | other.keys
|
8
|
+
result_hash = {}
|
9
|
+
|
10
|
+
all_keys.each do |key|
|
11
|
+
hash_value = {}
|
12
|
+
|
13
|
+
if key? key
|
14
|
+
value = self[key]
|
15
|
+
hash_value = value unless value.nil?
|
16
|
+
end
|
17
|
+
|
18
|
+
if other.key? key
|
19
|
+
value = other[key]
|
20
|
+
hash_value = hash_value.merge(value) unless value.nil?
|
21
|
+
end
|
22
|
+
|
23
|
+
result_hash[key] = hash_value
|
24
|
+
end
|
25
|
+
|
26
|
+
result_hash
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The String class
|
4
|
+
class String
|
5
|
+
# Sanitizes a filename
|
6
|
+
def sanitized
|
7
|
+
match = match(/(?m)(?<=\b_site).*$/)
|
8
|
+
sanitized_filename = match ? match[0] : self
|
9
|
+
sanitized_filename = sanitized_filename.gsub('index.html', '')
|
10
|
+
sanitized_filename.gsub('.html', '')
|
11
|
+
end
|
12
|
+
end
|
data/lib/sidebar.rb
CHANGED
@@ -3,211 +3,38 @@
|
|
3
3
|
require 'jekyll'
|
4
4
|
require 'nokogiri'
|
5
5
|
require 'json'
|
6
|
+
require_relative 'sidebar_page'
|
7
|
+
require_relative 'sidebar_parser'
|
8
|
+
require_relative 'sidebar_renderer'
|
9
|
+
require_relative 'sidebar_tree_builder'
|
6
10
|
|
7
|
-
module
|
11
|
+
module SwedbankPay
|
8
12
|
# A nice sidebar
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
def pre_render(page)
|
19
|
-
menu_order = page['menu_order'].nil? ? 0 : page['menu_order']
|
20
|
-
hide_from_sidebar = page['hide_from_sidebar'].nil? ? false : page['hide_from_sidebar']
|
21
|
-
url = page['url'].gsub('index.html', '').gsub('.html', '')
|
22
|
-
@hash_pre_render[url] = {
|
23
|
-
title: page['title'],
|
24
|
-
url: page['url'].gsub('.html', ''),
|
25
|
-
name: page['name'],
|
26
|
-
menu_order: menu_order,
|
27
|
-
hide_from_sidebar: hide_from_sidebar
|
28
|
-
}
|
29
|
-
end
|
30
|
-
|
31
|
-
def post_write(site)
|
32
|
-
files = []
|
33
|
-
Dir.glob("#{site.config['destination']}/**/*.html") do |filename|
|
34
|
-
doc = File.open(filename) { |f| Nokogiri::HTML(f) }
|
35
|
-
files.push(doc)
|
36
|
-
|
37
|
-
headers = []
|
38
|
-
doc.xpath('//h2 ').each do |header|
|
39
|
-
next unless header['id']
|
40
|
-
|
41
|
-
child = header.last_element_child
|
42
|
-
header = {
|
43
|
-
id: header['id'],
|
44
|
-
title: header.content.strip,
|
45
|
-
hash: (child['href']).to_s
|
46
|
-
}
|
47
|
-
headers.push(header)
|
48
|
-
end
|
49
|
-
sanitized_filename = sanitize_filename(filename)
|
50
|
-
@filename_with_headers[sanitized_filename] = { headers: headers }
|
13
|
+
module Sidebar
|
14
|
+
class << self
|
15
|
+
attr_reader :pages
|
16
|
+
|
17
|
+
def pre_render(site)
|
18
|
+
Jekyll.logger.debug(' Sidebar: pre_render')
|
19
|
+
@parser = SidebarParser.new(site)
|
20
|
+
@pages = SidebarTreeBuilder.new(@parser.pages)
|
21
|
+
Jekyll.logger.debug(" Sidebar: #{@pages.inspect}")
|
51
22
|
end
|
52
23
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
location.inner_html = sidebar
|
59
|
-
end
|
60
|
-
File.open(filename, 'w') { |f| f.write(file.to_html(encoding: 'UTF-8')) }
|
24
|
+
def post_write
|
25
|
+
@sidebar_renderer = SidebarRenderer.new(@pages)
|
26
|
+
@parser.parse(@pages)
|
27
|
+
Jekyll.logger.debug(' Sidebar: post_write')
|
28
|
+
@sidebar_renderer.render
|
61
29
|
end
|
62
|
-
|
63
|
-
# File.open('_site/sidebar.html', 'w') { |f| f.write(sidebar) }
|
64
|
-
end
|
65
|
-
|
66
|
-
private
|
67
|
-
|
68
|
-
def sanitize_filename(filename)
|
69
|
-
sanitized_filename = filename.match(/(?m)(?<=\b_site).*$/)[0]
|
70
|
-
sanitized_filename = sanitized_filename.gsub('index.html', '')
|
71
|
-
sanitized_filename.gsub('.html', '')
|
72
|
-
end
|
73
|
-
|
74
|
-
def generateSubgroup(filename, key, value, all_subgroups, level)
|
75
|
-
title = value[:title].split('–').last
|
76
|
-
|
77
|
-
subsubgroup_list = all_subgroups.select do |subsubgroup_key, _subsubgroup_value|
|
78
|
-
subsubgroup_key.include? key and subsubgroup_key != key and \
|
79
|
-
key.split('/').length > level
|
80
|
-
end
|
81
|
-
|
82
|
-
subgroup = ''
|
83
|
-
has_subgroups = !all_subgroups.empty?
|
84
|
-
if value[:headers].any? || !subsubgroup_list.empty?
|
85
|
-
if has_subgroups
|
86
|
-
url = value[:url]
|
87
|
-
active = active?(filename, url, true)
|
88
|
-
# puts "#{url}, #{filename}, #{key}" if active
|
89
|
-
item_class = active || (url.split('/').length > level && filename.start_with?(url)) ? 'nav-subgroup active' : 'nav-subgroup'
|
90
|
-
subgroup << "<li class=\"#{item_class}\">"
|
91
|
-
subgroup << "<div class=\"nav-subgroup-heading\"><i class=\"material-icons\">arrow_right</i><a href=\"#{url}\">#{title}</a></div>"
|
92
|
-
subgroup << '<ul class="nav-ul">'
|
93
|
-
|
94
|
-
if subsubgroup_list.empty?
|
95
|
-
value[:headers].each do |header|
|
96
|
-
subgroup << "<li class=\"nav-leaf\"><a href=\"#{value[:url]}#{header[:hash]}\">#{header[:title]}</a></li>"
|
97
|
-
end
|
98
|
-
else
|
99
|
-
subgroup_leaf_class = active ? 'nav-leaf nav-subgroup-leaf active' : 'nav-leaf nav-subgroup-leaf'
|
100
|
-
subgroup << "<li class=\"#{subgroup_leaf_class}\"><a href=\"#{value[:url]}\">#{title} overview</a></li>"
|
101
|
-
|
102
|
-
subsubgroup_list.each do |subsubgroup_key, subsubgroup_value|
|
103
|
-
subgroup << generateSubgroup(filename, subsubgroup_key, subsubgroup_value, subsubgroup_list, 3)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
subgroup << '</ul>'
|
108
|
-
subgroup << '</li>'
|
109
|
-
else
|
110
|
-
value[:headers].each do |header|
|
111
|
-
subgroup << "<li class=\"nav-leaf\"><a href=\"#{value[:url]}#{header[:hash]}\">#{header[:title]}</a></li>"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
else
|
115
|
-
subgroup << if has_subgroups
|
116
|
-
"<li class=\"nav-leaf nav-subgroup-leaf\"><a href=\"#{value[:url]}\">#{title}</a></li>"
|
117
|
-
else
|
118
|
-
"<li class=\"nav-leaf\"><a href=\"#{value[:url]}\">#{title}</a></li>"
|
119
|
-
end
|
120
|
-
end
|
121
|
-
|
122
|
-
subgroup
|
123
|
-
end
|
124
|
-
|
125
|
-
def render(filename)
|
126
|
-
sidebar = ''
|
127
|
-
|
128
|
-
merged = merge(@hash_pre_render, @filename_with_headers).sort_by { |_key, value| value[:menu_order] }
|
129
|
-
merged.select { |key, _value| key.split('/').length <= 2 }.each do |key, value|
|
130
|
-
next if value[:title].nil?
|
131
|
-
next if value[:hide_from_sidebar]
|
132
|
-
|
133
|
-
subgroups = merged.select { |subgroup_key, _subgroup_value| subgroup_key.include? key and subgroup_key != key and key != '/' }
|
134
|
-
|
135
|
-
active = active?(filename, key)
|
136
|
-
# puts "#{filename}, #{key}" if active
|
137
|
-
item_class = active ? 'nav-group active' : 'nav-group'
|
138
|
-
|
139
|
-
child = "<li class=\"#{item_class}\">"
|
140
|
-
child << "<div class=\"nav-group-heading\"><i class=\"material-icons\">arrow_right</i><span>#{value[:title].split('–').first}</span></div>"
|
141
|
-
|
142
|
-
child << '<ul class="nav-ul">'
|
143
|
-
|
144
|
-
subgroup = generateSubgroup(filename, key, value, subgroups, 2)
|
145
|
-
|
146
|
-
child << subgroup
|
147
|
-
|
148
|
-
if subgroups.any?
|
149
|
-
subgroups.select { |subgroup_key, _subgroup_value| subgroup_key.split('/').length <= 3 }.each do |subgroup_key, subgroup_value|
|
150
|
-
subgroup = generateSubgroup(filename, subgroup_key, subgroup_value, subgroups, 2)
|
151
|
-
child << subgroup
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
child << '</ul>'
|
156
|
-
child << '</li>'
|
157
|
-
sidebar << child
|
158
|
-
end
|
159
|
-
|
160
|
-
File.open('_site/sidebar.html', 'w') { |f| f.write(sidebar) }
|
161
|
-
sidebar
|
162
|
-
end
|
163
|
-
|
164
|
-
def active?(filename, url, exact = false)
|
165
|
-
if filename == '/' || url == '/'
|
166
|
-
if filename == '/' && url == '/'
|
167
|
-
return true
|
168
|
-
else
|
169
|
-
return false
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
exact ? filename == url : filename.start_with?(url)
|
174
|
-
end
|
175
|
-
|
176
|
-
def merge(hash1, hash2)
|
177
|
-
all_keys = hash1.keys | hash2.keys
|
178
|
-
result_hash = {}
|
179
|
-
|
180
|
-
all_keys.each do |key|
|
181
|
-
hash_value = {}
|
182
|
-
|
183
|
-
if hash1.key? key
|
184
|
-
value = hash1[key]
|
185
|
-
|
186
|
-
hash_value = value unless value.nil?
|
187
|
-
end
|
188
|
-
|
189
|
-
if hash2.key? key
|
190
|
-
value = hash2[key]
|
191
|
-
|
192
|
-
hash_value = hash_value.merge(value) unless value.nil?
|
193
|
-
end
|
194
|
-
|
195
|
-
result_hash[key] = hash_value
|
196
|
-
end
|
197
|
-
|
198
|
-
result_hash
|
199
30
|
end
|
200
31
|
end
|
201
32
|
end
|
202
33
|
|
203
|
-
|
204
|
-
|
205
|
-
Jekyll::Hooks.register :site, :pre_render do |site, _payload|
|
206
|
-
site.pages.each do |page|
|
207
|
-
sidebar.pre_render page
|
208
|
-
end
|
34
|
+
Jekyll::Hooks.register :site, :pre_render do |site, _|
|
35
|
+
SwedbankPay::Sidebar.pre_render site
|
209
36
|
end
|
210
37
|
|
211
|
-
Jekyll::Hooks.register :site, :post_write do
|
212
|
-
|
38
|
+
Jekyll::Hooks.register :site, :post_write do
|
39
|
+
SwedbankPay::Sidebar.post_write
|
213
40
|
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
# frozen_string_literal: false
|
2
|
+
|
3
|
+
require_relative 'sidebar_page'
|
4
|
+
|
5
|
+
module SwedbankPay
|
6
|
+
# The builder of HTML for the Sidebar
|
7
|
+
class SidebarHTMLBuilder
|
8
|
+
def initialize(tree)
|
9
|
+
@tree = tree
|
10
|
+
end
|
11
|
+
|
12
|
+
def build(current_page)
|
13
|
+
raise ArgumentError, 'current_page cannot be nil' if current_page.nil?
|
14
|
+
raise ArgumentError, "#{current_page.class} is not a #{SidebarPage}" unless current_page.is_a? SidebarPage
|
15
|
+
|
16
|
+
build_markup(@tree, current_page)
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def build_markup(pages, current_page)
|
22
|
+
return '' if pages.empty?
|
23
|
+
|
24
|
+
markup = ''
|
25
|
+
|
26
|
+
pages.each do |page|
|
27
|
+
current_page_name = current_page.respond_to?(:name) ? current_page.name : current_page.to_s
|
28
|
+
|
29
|
+
if page.hidden_for?(current_page)
|
30
|
+
Jekyll.logger.debug(" Sidebar: #{page.name} is hidden for #{current_page_name}")
|
31
|
+
next
|
32
|
+
elsif page.hidden?
|
33
|
+
Jekyll.logger.debug(" Sidebar: Hidden page #{page.name} is not hidden for #{current_page_name}")
|
34
|
+
end
|
35
|
+
|
36
|
+
sub_items_markup = sub_items_markup(page, current_page)
|
37
|
+
markup << item_markup(page, current_page, sub_items_markup, false)
|
38
|
+
end
|
39
|
+
|
40
|
+
markup
|
41
|
+
end
|
42
|
+
|
43
|
+
def item_markup(page, current_page, sub_items_markup, is_leaf)
|
44
|
+
# If we're rendering a leaf node, just set the level to a non-zero value
|
45
|
+
# to get the 'nav-subgroup' class and such.
|
46
|
+
level = is_leaf ? -1 : page.level
|
47
|
+
title_markup = title_markup(page, level, is_leaf)
|
48
|
+
item_class = item_class(page, current_page, level, is_leaf)
|
49
|
+
group_heading_class = group_heading_class(level)
|
50
|
+
|
51
|
+
"<li class=\"#{item_class}\">
|
52
|
+
<div class=\"#{group_heading_class}\">
|
53
|
+
<i class=\"material-icons\">arrow_right</i>
|
54
|
+
#{title_markup}
|
55
|
+
</div>
|
56
|
+
#{sub_items_markup}
|
57
|
+
</li>"
|
58
|
+
end
|
59
|
+
|
60
|
+
def item_class(page, current_page, level, is_leaf)
|
61
|
+
active = page.active?(current_page, is_leaf: is_leaf)
|
62
|
+
item_class = group_class(level)
|
63
|
+
item_class += ' active' if active
|
64
|
+
item_class
|
65
|
+
end
|
66
|
+
|
67
|
+
def group_class(level)
|
68
|
+
level.zero? ? 'nav-group' : 'nav-subgroup'
|
69
|
+
end
|
70
|
+
|
71
|
+
def group_heading_class(level)
|
72
|
+
group_class = group_class(level)
|
73
|
+
"#{group_class}-heading"
|
74
|
+
end
|
75
|
+
|
76
|
+
def title_markup(page, level, is_leaf)
|
77
|
+
lead_title = lead_title(page)
|
78
|
+
return "<span>#{lead_title}</span>" if level.zero?
|
79
|
+
|
80
|
+
main_title = main_title(page, is_leaf)
|
81
|
+
|
82
|
+
"<a href=\"#{page.path}\">#{main_title}</a>"
|
83
|
+
end
|
84
|
+
|
85
|
+
def sub_items_markup(page, current_page)
|
86
|
+
headers_markup = headers_markup(page, current_page)
|
87
|
+
child_markup = build_markup(page.children, current_page)
|
88
|
+
|
89
|
+
return '' if headers_markup.empty? && child_markup.empty?
|
90
|
+
|
91
|
+
"<ul class=\"nav-ul\">
|
92
|
+
#{headers_markup}
|
93
|
+
#{child_markup}
|
94
|
+
</ul>"
|
95
|
+
end
|
96
|
+
|
97
|
+
def headers_markup(page, current_page)
|
98
|
+
# If there's no page headers, only return a leaf item for the page itself.
|
99
|
+
main_title = page.title.nil? ? nil : page.title.main
|
100
|
+
return leaf_markup(page.path, main_title, page.level) unless page.headers?
|
101
|
+
|
102
|
+
# If there's no children, only return the headers as leaf node items.
|
103
|
+
return page.headers.map { |h| header_markup(page, h) }.join('') unless page.children?
|
104
|
+
|
105
|
+
headers_markup = page.headers.map { |h| header_markup(page, h) }.join('')
|
106
|
+
headers_markup = "<ul class=\"nav-ul\">#{headers_markup}</ul>"
|
107
|
+
|
108
|
+
item_markup(page, current_page, headers_markup, true)
|
109
|
+
end
|
110
|
+
|
111
|
+
def header_markup(page, header)
|
112
|
+
hash = header[:hash]
|
113
|
+
subtitle = header[:title]
|
114
|
+
href = "#{page.path}#{hash}"
|
115
|
+
leaf_markup(href, subtitle)
|
116
|
+
end
|
117
|
+
|
118
|
+
def leaf_markup(href, title, level = 0)
|
119
|
+
leaf_class = level.positive? ? 'nav-leaf nav-subgroup-leaf' : 'nav-leaf'
|
120
|
+
"<li class=\"#{leaf_class}\"><a href=\"#{href}\">#{title}</a></li>"
|
121
|
+
end
|
122
|
+
|
123
|
+
def lead_title(page)
|
124
|
+
return page.title.lead unless page.title.nil? || page.title.lead.nil?
|
125
|
+
return page.parent.title.to_s unless page.parent.nil? || page.parent.title.nil?
|
126
|
+
|
127
|
+
''
|
128
|
+
end
|
129
|
+
|
130
|
+
def main_title(page, is_leaf)
|
131
|
+
unless page.nil? || page.title.nil?
|
132
|
+
lead_title = lead_title(page)
|
133
|
+
parent_lead_title = parent_lead_title(page)
|
134
|
+
main_title = page.title.main
|
135
|
+
|
136
|
+
# If the lead title is different to the parent's or we're not on a leaf
|
137
|
+
# node item, use the lead title as the main title. This causes 'section: Card'
|
138
|
+
# to be used as title for the Card item, but allows the nav-subgroup-heading
|
139
|
+
# 'Introduction' item to use the main title 'Introduction'.
|
140
|
+
main_title = lead_title unless lead_title == parent_lead_title || is_leaf
|
141
|
+
|
142
|
+
return main_title || page.title.to_s
|
143
|
+
end
|
144
|
+
|
145
|
+
''
|
146
|
+
end
|
147
|
+
|
148
|
+
def parent_lead_title(page)
|
149
|
+
return page.parent.title.lead unless page.parent.nil? || page.parent.title.nil?
|
150
|
+
|
151
|
+
nil
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|