Skip to content

Commit ea716f0

Browse files
authored
Release V.1.0.2 (#117)
Just the docs v0.10.0 The following updates the core dependancy of Just the docs from v0.8.0 to v0.10.0. This gives an opportunity to remove: 1. Grand_parent (Function) to be replaced with just parent and children. 2. Easier to manage. - Note that with this No title can be the same in a file, if its the same the Url part has to be different. Additionally added a few files to overwrite a few that are usually defined globally, but to assure it works as intended. Removed Nav, no longer required. --- Removed GrandParent In previous version grand_parent was required, now it can just use parent: previous file . As required Files and issues have now been modified according to it. Fixes --- #110 [BUG] - Git & github 3rd child not shown #61 [ADDRESS] Child in Child in Child Content New --- ![image](https://github.com/user-attachments/assets/8b550149-b910-49ef-903c-1e3677bd8706) Previous --- ![image](https://github.com/user-attachments/assets/eb362b02-ac4e-44b3-94e4-1e24cd043a71) Known Issues --- - Currently none (Tested on mobile / Pc).
2 parents 6e60ca6 + c662d70 commit ea716f0

30 files changed

+441
-107
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
33
gem "jekyll", "~> 4.3.2" # installed by `gem jekyll`
44
# gem "webrick" # required when using Ruby >= 3 and Jekyll <= 4.2.2
55

6-
gem "just-the-docs", "0.8.0" # pinned to the current Release
6+
gem "just-the-docs", "0.10.0" # pinned to the current Release
77
# gem "just-the-docs" # always download the latest release
88

99
gem 'jekyll-last-modified-at', '~> 1.1' # pinned to the current Release

Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ GEM
4343
jekyll (>= 3.8, < 5.0)
4444
jekyll-watch (2.2.1)
4545
listen (~> 3.0)
46-
just-the-docs (0.8.0)
46+
just-the-docs (0.10.0)
4747
jekyll (>= 3.8.5)
4848
jekyll-include-cache
4949
jekyll-seo-tag (>= 2.0)
@@ -84,7 +84,7 @@ PLATFORMS
8484
DEPENDENCIES
8585
jekyll (~> 4.3.2)
8686
jekyll-last-modified-at (~> 1.1)
87-
just-the-docs (= 0.8.0)
87+
just-the-docs (= 0.10.0)
8888

8989
BUNDLED WITH
9090
2.3.26

_config.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,7 @@ last-modified-at:
1818
date-format: '%d/%m/%Y'
1919

2020
# Color Theme
21-
color_scheme: light
21+
color_scheme: light
22+
23+
# Show navigation error report
24+
nav_error_report: true # default is false/nil.

_includes/components/breadcrumbs.html

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
{%- comment -%}
2+
Include as: {%- include components/breadcrumbs.html -%}
3+
Depends on: page, site.
4+
Includes: components/site_nav.html.
5+
Results in: HTML for the breadcrumbs component.
6+
Overwrites:
7+
nav_list_link, site_nav, nav_list_simple, nav_list_link_class, nav_category,
8+
nav_anchor_splits, nav_breadcrumbs, nav_split, nav_split_next, nav_split_test,
9+
nav_breadcrumb_link, nav_list_end_less, nav_list_end_count, nav_end_index, nav_breadcrumb.
10+
{%- endcomment -%}
11+
12+
{%- if page.url != "/" and page.parent and page.title -%}
13+
14+
{%- capture nav_list_link -%}
15+
<a href="{{ page.url | relative_url }}" class="nav-list-link">
16+
{%- endcapture -%}
17+
18+
{%- capture site_nav -%}
19+
{%- include_cached components/site_nav.html all=true -%}
20+
{%- endcapture -%}
21+
22+
{%- capture nav_list_simple -%}
23+
<ul class="nav-list">
24+
{%- endcapture -%}
25+
26+
{%- capture nav_list_link_class %} class="nav-list-link">
27+
{%- endcapture -%}
28+
29+
{%- capture nav_category -%}
30+
<div class="nav-category">
31+
{%- endcapture -%}
32+
33+
{%- assign nav_anchor_splits =
34+
site_nav | split: nav_list_link |
35+
first | split: nav_category |
36+
last | split: "</a>" -%}
37+
38+
{%- comment -%}
39+
The ordinary pages (if any) and the collections pages (if any) are separated by
40+
occurrences of nav_category.
41+
42+
Any ancestor nav-links of the page are contained in the last group of pages,
43+
immediately preceding nav-lists. After splitting at "</a>", the anchor that
44+
was split is a potential ancestor link when the following split starts with
45+
a nav-list.
46+
47+
The array nav_breadcrumbs is the stack of current potential ancestors of the
48+
current page. A split that contains one or more "</ul>"s requires that number
49+
of potential ancestors to be popped from the stack.
50+
51+
The number of occurrences of a string in nav_split_next is computed by removing
52+
them all, then dividing the resulting size difference by the length of the string.
53+
{%- endcomment %}
54+
55+
{%- assign nav_breadcrumbs = "" | split: "" -%}
56+
57+
{%- for nav_split in nav_anchor_splits -%}
58+
{%- unless forloop.last -%}
59+
60+
{%- assign nav_split_next = nav_anchor_splits[forloop.index] | strip -%}
61+
62+
{%- assign nav_split_test =
63+
nav_split_next | remove_first: nav_list_simple | prepend: nav_list_simple -%}
64+
{%- if nav_split_test == nav_split_next -%}
65+
{%- assign nav_breadcrumb_link =
66+
nav_split | split: "<a " | last | prepend: "<a " |
67+
replace: nav_list_link_class, ">" | append: "</a>" -%}
68+
{%- assign nav_breadcrumbs = nav_breadcrumbs | push: nav_breadcrumb_link -%}
69+
{%- endif -%}
70+
71+
{%- if nav_split_next contains "</ul>" -%}
72+
{%- assign nav_list_end_less = nav_split_next | remove: "</ul>" -%}
73+
{%- assign nav_list_end_count =
74+
nav_split_next.size | minus: nav_list_end_less.size | divided_by: 5 -%}
75+
{% for nav_end_index in (1..nav_list_end_count) %}
76+
{%- assign nav_breadcrumbs = nav_breadcrumbs | pop -%}
77+
{%- endfor -%}
78+
{%- endif -%}
79+
80+
{%- endunless -%}
81+
{%- endfor -%}
82+
83+
<nav aria-label="Breadcrumb" class="breadcrumb-nav">
84+
<ol class="breadcrumb-nav-list">
85+
{%- for nav_breadcrumb in nav_breadcrumbs %}
86+
<li class="breadcrumb-nav-list-item">{{ nav_breadcrumb }}</li>
87+
{%- endfor %}
88+
<li class="breadcrumb-nav-list-item"><span>{{ page.title }}</span></li>
89+
</ol>
90+
</nav>
91+
92+
{% if site.nav_error_report %}
93+
{{ nav_error_report }}
94+
{% endif %}
95+
96+
{%- endif -%}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
{%- comment -%}
2+
Include as: {%- include components/children_nav.html -%}
3+
Depends on: page, site, nav_breadcrumbs.
4+
Results in: HTML for the children-navigation component.
5+
Includes: components/nav/sorted.html, toc_heading_custom.html.
6+
Overwrites:
7+
nav_ancestor_links, nav_top_node_titles, nav_child_candidates, nav_children,
8+
nav_child, nav_child_ok, nav_child_ancestor, nav_sorted.
9+
{%- endcomment -%}
10+
11+
{%- comment -%}
12+
Whether a page has any children is checked efficiently by inspecting the cached
13+
site_nav. If the page has no children, nav_children is set to an empty array;
14+
otherwise nav_children is left unset.
15+
{%- endcomment -%}
16+
17+
{%- if page.has_children == false -%}
18+
{%- assign nav_children = "" | split: "" -%}
19+
{%- else -%}
20+
21+
{%- assign nav_children = nil -%}
22+
23+
{%- capture nav_list_link -%}
24+
<a href="{{ page.url | relative_url }}" class="nav-list-link">
25+
{%- endcapture -%}
26+
27+
{%- capture site_nav -%}
28+
{%- include_cached components/site_nav.html all=true -%}
29+
{%- endcapture -%}
30+
31+
{%- capture nav_list_simple -%}
32+
<ul class="nav-list">
33+
{%- endcapture -%}
34+
35+
{%- assign nav_child_start = site_nav
36+
| split: nav_list_link | last
37+
| split: "</a>" | slice: 1 | first -%}
38+
39+
{%- assign nav_child_test = nav_child_start
40+
| remove_first: nav_list_simple | prepend: nav_list_simple -%}
41+
42+
{%- if nav_child_start != nav_child_test -%}
43+
{%- assign nav_children = "" | split: "" -%}
44+
{%- endif -%}
45+
46+
{%- endif -%}
47+
48+
{%- unless nav_children -%}
49+
50+
{%- comment -%}
51+
The layout is assumed to include components/breadcrumbs.html before this file,
52+
otherwise it needs to be included here.
53+
{%- endcomment -%}
54+
55+
{%- assign nav_ancestors = "" | split: "" -%}
56+
{%- for nav_link in nav_breadcrumbs -%}
57+
{%- assign nav_title = nav_link | split: ">" | slice: 1 | first | append: ">" | remove: "</a>" -%}
58+
{%- assign nav_ancestors = nav_ancestors | push: nav_title -%}
59+
{%- endfor -%}
60+
61+
{%- assign nav_parenthood = site[page.collection] | default: site.html_pages
62+
| where_exp: "item", "item.title != nil" | group_by: "parent" -%}
63+
64+
{%- assign nav_top_nodes = nav_parenthood
65+
| where_exp: "item", "item.name == ''" | map: "items" | first -%}
66+
67+
{% assign nav_top_node_titles = nav_top_nodes | map: "title" -%}
68+
69+
{%- include components/nav/children.html node=page ancestors=nav_ancestors all=true -%}
70+
71+
{%- endunless -%}
72+
73+
{%- if nav_children.size >= 1 -%}
74+
75+
{%- if page.child_nav_order == 'desc' or page.child_nav_order == 'reversed' -%}
76+
{%- assign nav_children = nav_children | reverse -%}
77+
{%- endif -%}
78+
79+
<hr>
80+
{% include toc_heading_custom.html %}
81+
<ul>
82+
{% for nav_child in nav_children %}
83+
<li>
84+
<a href="{{ nav_child.url | relative_url }}">{{ nav_child.title }}</a>{% if nav_child.summary %} - {{ nav_child.summary }}{% endif %}
85+
</li>
86+
{% endfor %}
87+
</ul>
88+
89+
{%- endif -%}

_includes/components/nav.html

Lines changed: 0 additions & 75 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{%- comment -%}
2+
Include as: {%- include components/nav/children.html node=node ancestors=title_array all=bool -%}
3+
Depends on: include.node, include.ancestors, include.all, nav_parenthood, nav_top_node_titles.
4+
Includes: components/nav/sorted.html.
5+
Assigns to: nav_children.
6+
Overwrites:
7+
nav_candidates, nav_child, nav_child_ok.
8+
{%- endcomment -%}
9+
10+
{%- assign nav_children = "" | split: "" -%}
11+
12+
{%- if include.all == true or include.node.has_children != false -%}
13+
14+
{%- assign nav_candidates = nav_parenthood
15+
| where: "name", include.node.title | map: "items" | first -%}
16+
17+
{%- for nav_child in nav_candidates -%}
18+
{%- assign nav_child_ok = true -%}
19+
20+
{%- if nav_child.grand_parent and nav_child.grand_parent != include.node.parent -%}
21+
{%- assign nav_child_ok = false -%}
22+
{%- endif -%}
23+
24+
{%- if nav_child.ancestor and nav_child.ancestor != include.node.title -%}
25+
{%- unless include.ancestors contains nav_child.ancestor -%}
26+
{%- assign nav_child_ok = false -%}
27+
{%- endunless -%}
28+
{%- endif -%}
29+
30+
{%- comment -%}
31+
The following check rejects nav_child as 3rd-level when include.node is 2nd-level
32+
and nav_child can also be 2nd-level. This is for backwards compatibility with
33+
existing 3-level sites.
34+
{%- endcomment -%}
35+
{%- if nav_child.grand_parent == nil and nav_child.ancestor == nil and
36+
nav_top_node_titles contains nav_child.parent and include.ancestors.size >= 1 -%}
37+
{%- assign nav_child_ok = false -%}
38+
{%- endif -%}
39+
40+
{%- if nav_child_ok -%}
41+
{%- assign nav_children = nav_children | push: nav_child -%}
42+
{%- endif -%}
43+
{%- endfor -%}
44+
45+
{%- endif -%}
46+
47+
{%- include components/nav/sorted.html pages=nav_children -%}
48+
{%- assign nav_children = nav_sorted -%}

0 commit comments

Comments
 (0)