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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 293de6305ef2f25244dab21522972c4c71789fc3218c661fa2a6de84d1e44296
4
- data.tar.gz: e48256ed80fecb7a43b8d8a0f83aa307351fa03939d8e92c617a010a26fdb030
3
+ metadata.gz: e70d0e90dc5b556e1bec064d67d458e792802fa31223e6e23583bb0b772bf7d3
4
+ data.tar.gz: b67f7f5aa6a1136d3d096d85d5ec455c2c25d3f344c7993bc06716aac16122f2
5
5
  SHA512:
6
- metadata.gz: 4099d8b27df6a76b5efc47a51100eaae9d90144746197fe1cb2b941df713386f3bad73962f8594c7393ff28bb18c6e0d2ca4d22be3c3afa425a0b78cf21d1e97
7
- data.tar.gz: 33fbea2152a2a564d8232b160c5515834ffae24794ebbd469f62b25676a7e5b9eeac46e250df3ed25f3b93069516cc75e616f52851f0b4001c8974954c2a81b2
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.0
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-16 00:00:00.000000000 Z
12
+ date: 2022-11-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler