fni-docs-theme 0.6.0 → 0.6.1
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/lib/generators/nav-generator.rb +23 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e70d0e90dc5b556e1bec064d67d458e792802fa31223e6e23583bb0b772bf7d3
|
4
|
+
data.tar.gz: b67f7f5aa6a1136d3d096d85d5ec455c2c25d3f344c7993bc06716aac16122f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7e8be9d8596a5eaaa14c09b65e121fbf819e70740a8be48d3bedc7327de6de7529697dca678ffb9cedc0df4bd341267ff295e6e9d2b48fe9faa1886005098b2a
|
7
|
+
data.tar.gz: 200aa0ae8db22e8d6b5456ebbecd53523fe574f9f2a06dcc6d113593cce6b4d7aa84e9b514ce59b902b9b0675a14e7d1f4b3293c2632e979f4d51851ffbeab5b
|
@@ -5,6 +5,9 @@ module NavGenerator
|
|
5
5
|
def generate(site)
|
6
6
|
nav = nav_for_parent(site.pages, nil, nil)
|
7
7
|
|
8
|
+
# Breadcrumbs
|
9
|
+
breadcrumb = breadcrumb_for_parent(site.pages, nil, nil)
|
10
|
+
|
8
11
|
# Attach nav data to the default layout
|
9
12
|
site.layouts['default'].data['nav'] = nav
|
10
13
|
end
|
@@ -21,10 +24,6 @@ module NavGenerator
|
|
21
24
|
# Attach the child data to the page itself, used to render the footer Table of Contents
|
22
25
|
page.data['children'] = children
|
23
26
|
|
24
|
-
# Attach parent/grandparent URLs for rendering breadcrumb
|
25
|
-
page.data['parent_url'] = parentPage&.url
|
26
|
-
page.data['grand_parent_url'] = grandParentPage&.url
|
27
|
-
|
28
27
|
{
|
29
28
|
'title' => page.data['title'],
|
30
29
|
'url' => page.url,
|
@@ -32,5 +31,25 @@ module NavGenerator
|
|
32
31
|
}
|
33
32
|
}
|
34
33
|
end
|
34
|
+
|
35
|
+
def breadcrumb_for_parent(page_list, parentPage, grandParentPage)
|
36
|
+
parentPageTitle = parentPage && parentPage.data['title']
|
37
|
+
pages = page_list
|
38
|
+
.filter { |page| page.data['parent'] == parentPageTitle && page.data['title'] != nil }
|
39
|
+
.sort_by { |page| [page.data['nav_order'] || 999, page.data['title']] }
|
40
|
+
|
41
|
+
nav = pages.map { |page|
|
42
|
+
children = breadcrumb_for_parent(page_list, page, parentPage)
|
43
|
+
|
44
|
+
# Attach parent/grandparent URLs for rendering breadcrumb
|
45
|
+
page.data['parent_url'] = parentPage&.url
|
46
|
+
page.data['grand_parent_url'] = grandParentPage&.url
|
47
|
+
|
48
|
+
{
|
49
|
+
'parent_url' => parentPage&.url,
|
50
|
+
'grand_parent_url' => grandParentPage&.url
|
51
|
+
}
|
52
|
+
}
|
53
|
+
end
|
35
54
|
end
|
36
55
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fni-docs-theme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Marsceill
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-11-
|
12
|
+
date: 2022-11-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|