jekyll-theme-guides-mbland 1.0.4 → 1.0.5
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e579a12a87de02f5a9c1969c6c36e613bfce795c
|
4
|
+
data.tar.gz: b67f5d052e169b7f632a14a13484f33692fca7e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9557bafc54d8148157cecc4759c2615311281b790d7f5e3088da0bed992a9eb5779a8013a12cee2c87a3bf7e62c9ce8ad5eb51a8b237c86318858d3fe943ce5
|
7
|
+
data.tar.gz: 3a708fbd8ff3be6a0ab7c617c1ec06993beddab235505b14fe8690baf01982a0873a952ac9e7a0196e82a3f2b168913b40eda2fa071d69ff15c26efd86e75585
|
@@ -6,12 +6,12 @@
|
|
6
6
|
<ul class="nav-children" id="nav-collapsible-{{ forloop.index }}"
|
7
7
|
aria-hidden="{% if expand_nav == 'true' %}false{% else %}true{% endif %}">
|
8
8
|
{% if site.flat_namespace %}{% assign parent_url = '/' %}{% endif %}{% for child in parent.children %}
|
9
|
-
{% capture child_url %}{{ parent_url }}{{ child.url }}{% endcapture %}
|
9
|
+
{% capture child_url %}{% if child.internal == true %}{{ parent_url }}{% endif %}{{ child.url }}{% endcapture %}
|
10
10
|
<li class="{% if page.url == child_url %}sidebar-nav-active{% endif %}">
|
11
11
|
<a href="{% if child.internal == true %}{{ site.baseurl }}{{ child_url }}{% else %}{{ child.url }}{% endif %}"
|
12
12
|
title="{% if page.url == child_url %}Current Page{% else %}{{ child.text }}{% endif %}">{{ child.text }}</a>
|
13
|
-
{% assign parent = child %}{% assign parent_url = child_url %}
|
13
|
+
{% if child.children %}{% assign parent = child %}{% assign parent_url = child_url %}
|
14
14
|
{% include sidebar-children.html %}
|
15
|
-
{% capture parent_url %}{% jekyll_theme_guides_mbland_pop_last_url_component parent_url %}{% endcapture %}
|
15
|
+
{% capture parent_url %}{% jekyll_theme_guides_mbland_pop_last_url_component parent_url %}{% endcapture %}{% endif %}
|
16
16
|
</li>{% endfor %}
|
17
17
|
</ul>{% endif %}
|
@@ -129,12 +129,31 @@ module JekyllThemeGuidesMbland
|
|
129
129
|
config_data = SafeYAML.load_file config_path, safe: true
|
130
130
|
return unless config_data
|
131
131
|
nav_data = config_data['navigation'] || []
|
132
|
+
NavigationMenu.validate_existing_data(nav_data)
|
132
133
|
NavigationMenu.update_navigation_data(nav_data, basedir, config_data)
|
133
134
|
NavigationMenuWriter.write_navigation_data_to_config_file(config_path,
|
134
135
|
nav_data)
|
135
136
|
end
|
136
137
|
|
137
138
|
module NavigationMenu
|
139
|
+
def self.validate_existing_data(nav_data)
|
140
|
+
errors = []
|
141
|
+
validate_existing_data_impl(nav_data, errors)
|
142
|
+
err_msg = "Existing navigation entries contain errors:\n " +
|
143
|
+
errors.join("\n ") + "\n_config.yml not updated"
|
144
|
+
abort err_msg unless errors.empty?
|
145
|
+
end
|
146
|
+
|
147
|
+
def self.validate_existing_data_impl(nav_data, errors)
|
148
|
+
nav_data.each do |nav|
|
149
|
+
if !nav['internal'] && nav['children']
|
150
|
+
errors << "#{nav['text']}: external navigation URLs " \
|
151
|
+
'cannot have children'
|
152
|
+
end
|
153
|
+
validate_existing_data_impl(nav['children'] || [], errors)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
138
157
|
def self.update_navigation_data(nav_data, basedir, config_data)
|
139
158
|
original = map_nav_items_by_url('/', nav_data).to_h
|
140
159
|
updated = updated_nav_data(basedir)
|
@@ -229,7 +248,7 @@ module JekyllThemeGuidesMbland
|
|
229
248
|
def self.write_navigation_data_to_config_file(config_path, nav_data)
|
230
249
|
lines = []
|
231
250
|
in_navigation = false
|
232
|
-
open(config_path).each_line do |line|
|
251
|
+
File.open(config_path).each_line do |line|
|
233
252
|
in_navigation = process_line line, lines, nav_data, in_navigation
|
234
253
|
end
|
235
254
|
File.write config_path, lines.join
|
@@ -8,7 +8,7 @@ module JekyllThemeGuidesMbland
|
|
8
8
|
|
9
9
|
attr_reader :parent_reference, :url_reference
|
10
10
|
|
11
|
-
def initialize(_tag_name, markup,
|
11
|
+
def initialize(_tag_name, markup, _tokens)
|
12
12
|
references = markup.split(',').map(&:strip)
|
13
13
|
@parent_reference = references.shift
|
14
14
|
@url_reference = references.shift
|
@@ -37,7 +37,7 @@ module JekyllThemeGuidesMbland
|
|
37
37
|
|
38
38
|
attr_reader :reference
|
39
39
|
|
40
|
-
def initialize(_tag_name, markup,
|
40
|
+
def initialize(_tag_name, markup, _tokens)
|
41
41
|
@reference = markup.strip
|
42
42
|
end
|
43
43
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-theme-guides-mbland
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Bland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -224,7 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
224
|
version: '0'
|
225
225
|
requirements: []
|
226
226
|
rubyforge_project:
|
227
|
-
rubygems_version: 2.6.
|
227
|
+
rubygems_version: 2.6.11
|
228
228
|
signing_key:
|
229
229
|
specification_version: 4
|
230
230
|
summary: Guides style elements for Jekyll
|