fni-docs-theme 0.5.0 → 0.6.0

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: e933eb121bdcdfa9df47685ce09f42f27071fd179cfe6572fbbcefa3111d0a9f
4
- data.tar.gz: '0950106a53c0b4b1de583e9ebcd8a053834ef656faf500690939cc7e25e2d96a'
3
+ metadata.gz: 293de6305ef2f25244dab21522972c4c71789fc3218c661fa2a6de84d1e44296
4
+ data.tar.gz: e48256ed80fecb7a43b8d8a0f83aa307351fa03939d8e92c617a010a26fdb030
5
5
  SHA512:
6
- metadata.gz: d1fb045cea52ce688d50b0bf0d231d6534315c390d88dce8f7fbf4b7b0e568dc9a94ac7787ef5d6302cdfa34c6db67ce7d7edbe93af5ce4a871c3b9cb98a9092
7
- data.tar.gz: 8e05c044f0db819f2812e96e008d35fc90c91945d674e981856793331ae8f843703eca8e374775484147fdf1d24ca0cd5995f9cb97b5f3df2763bda17cdabe1a
6
+ metadata.gz: 4099d8b27df6a76b5efc47a51100eaae9d90144746197fe1cb2b941df713386f3bad73962f8594c7393ff28bb18c6e0d2ca4d22be3c3afa425a0b78cf21d1e97
7
+ data.tar.gz: 33fbea2152a2a564d8232b160c5515834ffae24794ebbd469f62b25676a7e5b9eeac46e250df3ed25f3b93069516cc75e616f52851f0b4001c8974954c2a81b2
data/README.md CHANGED
@@ -29,10 +29,22 @@ plugins:
29
29
 
30
30
  [View the documentation](https://pmarsceill.github.io/just-the-docs/) for usage information.
31
31
 
32
+ ## Local Testing
33
+
34
+ ```bash
35
+ > ./serve
36
+ ```
37
+
38
+ Access the site at http://localhost:4000/fni-docs-theme/
39
+
32
40
  ## Publishing
33
41
 
34
42
  This theme/plugin is published as fni-docs-theme to rubygems.org.
35
43
 
44
+ To publish a new version:
45
+ * Bump the version in the fni-docs-theme.gemspec
46
+ * Run the Publish Gem Github Action
47
+
36
48
  ## License
37
49
 
38
50
  The theme is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
@@ -100,28 +100,13 @@ layout: table_wrappers
100
100
  <div id="main-content-wrap" class="main-content-wrap">
101
101
  {% unless page.url == "/" %}
102
102
  {% if page.parent %}
103
- {%- for node in pages_list -%}
104
- {%- if node.parent == nil -%}
105
- {%- if page.parent == node.title or page.grand_parent == node.title -%}
106
- {%- assign first_level_url = node.url | absolute_url -%}
107
- {%- endif -%}
108
- {%- if node.has_children -%}
109
- {%- assign children_list = pages_list | where: "parent", node.title -%}
110
- {%- for child in children_list -%}
111
- {%- if page.url == child.url or page.parent == child.title -%}
112
- {%- assign second_level_url = child.url | absolute_url -%}
113
- {%- endif -%}
114
- {%- endfor -%}
115
- {%- endif -%}
116
- {%- endif -%}
117
- {%- endfor -%}
118
103
  <nav aria-label="Breadcrumb" class="breadcrumb-nav">
119
104
  <ol class="breadcrumb-nav-list">
120
105
  {% if page.grand_parent %}
121
- <li class="breadcrumb-nav-list-item"><a href="{{ first_level_url }}">{{ page.grand_parent }}</a></li>
122
- <li class="breadcrumb-nav-list-item"><a href="{{ second_level_url }}">{{ page.parent }}</a></li>
106
+ <li class="breadcrumb-nav-list-item"><a href="{{ page.grand_parent_url | absolute_url }}">{{ page.grand_parent }}</a></li>
107
+ <li class="breadcrumb-nav-list-item"><a href="{{ page.parent_url | absolute_url }}">{{ page.parent }}</a></li>
123
108
  {% else %}
124
- <li class="breadcrumb-nav-list-item"><a href="{{ first_level_url }}">{{ page.parent }}</a></li>
109
+ <li class="breadcrumb-nav-list-item"><a href="{{ page.parent_url | absolute_url }}">{{ page.parent }}</a></li>
125
110
  {% endif %}
126
111
  <li class="breadcrumb-nav-list-item"><span>{{ page.title }}</span></li>
127
112
  </ol>
@@ -139,7 +124,7 @@ layout: table_wrappers
139
124
  <hr>
140
125
  <h2 class="text-delta">Subtopics</h2>
141
126
  <ul>
142
- {% for child in page.nav %}
127
+ {% for child in page.children %}
143
128
  <li>
144
129
  <a href="{{ child.url | absolute_url }}">{{ child.title }}</a>{% if child.summary %} - {{ child.summary }}{% endif %}
145
130
  </li>
@@ -3,22 +3,27 @@ module NavGenerator
3
3
  # Generate a sorted page heirarchy based on parent / grand_parent
4
4
  # TODO: If a new page is added to the site, need to hook into incremental rebuild and flush nav.html cache
5
5
  def generate(site)
6
- nav = nav_for_parent(site.pages, nil)
6
+ nav = nav_for_parent(site.pages, nil, nil)
7
7
 
8
8
  # Attach nav data to the default layout
9
9
  site.layouts['default'].data['nav'] = nav
10
10
  end
11
11
 
12
- def nav_for_parent(page_list, parent)
12
+ def nav_for_parent(page_list, parentPage, grandParentPage)
13
+ parentPageTitle = parentPage && parentPage.data['title']
13
14
  pages = page_list
14
- .filter { |page| page.data['parent'] == parent && page.data['title'] != nil && page.data['nav_exclude'] != true }
15
+ .filter { |page| page.data['parent'] == parentPageTitle && page.data['title'] != nil && page.data['nav_exclude'] != true }
15
16
  .sort_by { |page| [page.data['nav_order'] || 999, page.data['title']] }
16
17
 
17
18
  nav = pages.map { |page|
18
- children = page.data['has_children'] && nav_for_parent(page_list, page.data['title'])
19
+ children = page.data['has_children'] && nav_for_parent(page_list, page, parentPage)
19
20
 
20
21
  # Attach the child data to the page itself, used to render the footer Table of Contents
21
- page.data['nav'] = children
22
+ page.data['children'] = children
23
+
24
+ # Attach parent/grandparent URLs for rendering breadcrumb
25
+ page.data['parent_url'] = parentPage&.url
26
+ page.data['grand_parent_url'] = grandParentPage&.url
22
27
 
23
28
  {
24
29
  'title' => page.data['title'],
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.5.0
4
+ version: 0.6.0
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-01-31 00:00:00.000000000 Z
12
+ date: 2022-11-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
198
  - !ruby/object:Gem::Version
199
199
  version: '0'
200
200
  requirements: []
201
- rubygems_version: 3.2.32
201
+ rubygems_version: 3.3.7
202
202
  signing_key:
203
203
  specification_version: 4
204
204
  summary: Fork of just-the-docs