just-the-docs 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -2
- data/_includes/components/breadcrumbs.html +60 -108
- data/_includes/components/children_nav.html +72 -16
- data/_includes/components/nav/children.html +48 -0
- data/_includes/components/nav/links.html +53 -0
- data/_includes/components/nav/pages.html +23 -0
- data/_includes/{sorted_pages.html → components/nav/sorted.html} +3 -3
- data/_includes/components/site_nav.html +12 -7
- data/_includes/css/activation.scss.liquid +257 -264
- data/_layouts/default.html +1 -1
- metadata +6 -4
- data/_includes/components/nav.html +0 -75
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 555f04daa56535911096cb34c790bb8c8b89a617f398cbf93378954387ac1f1e
|
4
|
+
data.tar.gz: 873150f2912a9a83d170f2ceb98d725f507a39e49ebb990885887c4c980c4378
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5385791a026feeb7b51730f7bcd5bfc63afa4ca886467eea5bc443ce6de90cee66e4fa6b47747f8014830abfdaf21c138a65deae0f673205ebc0bc3c0a928375
|
7
|
+
data.tar.gz: 9285866faa3b41d50cd048a7ef587efc4f15fe7c8003c0e8d3387aa3538cf74692f501b780515df44011dd62fe7e91c46f1ec033dc7b1a0705a2c77b443849eb
|
data/CHANGELOG.md
CHANGED
@@ -23,6 +23,45 @@ Docs changes made since the latest release:
|
|
23
23
|
|
24
24
|
- N/A
|
25
25
|
|
26
|
+
## Release v0.10.0
|
27
|
+
|
28
|
+
Hi folks! This minor release adds one of our most-requested features: unlimited multi-level navigation (also known as recursive navigation). Huge thanks to [@pdmosses] for his wonderful work in implementing this feature!
|
29
|
+
|
30
|
+
This release should be a straightforward upgrade for all users of Just the Docs. Thank you for your continued support!
|
31
|
+
|
32
|
+
### Using Release `v0.10.0`
|
33
|
+
|
34
|
+
Users who have not pinned the theme version will be **automatically upgraded to `v0.9.0` the next time they build their site**.
|
35
|
+
|
36
|
+
To use this release explicitly as a remote theme:
|
37
|
+
|
38
|
+
```yml
|
39
|
+
remote_theme: just-the-docs/just-the-docs@v0.10.0
|
40
|
+
```
|
41
|
+
|
42
|
+
To use this version explicitly as a gem-based theme, pin the version in your `Gemfile` and re-run `bundle install` or `bundle update just-the-docs`:
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
gem "just-the-docs", "0.10.0"
|
46
|
+
```
|
47
|
+
|
48
|
+
To use and pin a previous version of the theme, replace the `0.10.0` with the desired release tag.
|
49
|
+
|
50
|
+
### New Features
|
51
|
+
|
52
|
+
- Added: Allow unlimited multi-level navigation by [@pdmosses] in [#1431]
|
53
|
+
|
54
|
+
### Documentation
|
55
|
+
|
56
|
+
- Added: Allow unlimited multi-level navigation by [@pdmosses] in [#1440]
|
57
|
+
- Added: sitemap (via `jekyll-sitemap` plugin) by [@mattxwang] in [#1530]
|
58
|
+
- Fixed: (non-systemic) accessibility issues flagged by aXe by [@mattxwang] in [#1531]
|
59
|
+
|
60
|
+
[#1431]: https://github.com/just-the-docs/just-the-docs/pull/1431
|
61
|
+
[#1440]: https://github.com/just-the-docs/just-the-docs/pull/1440
|
62
|
+
[#1530]: https://github.com/just-the-docs/just-the-docs/pull/1530
|
63
|
+
[#1530]: https://github.com/just-the-docs/just-the-docs/pull/1531
|
64
|
+
|
26
65
|
## Release v0.9.0
|
27
66
|
|
28
67
|
Hi folks! This minor release adds a `nav_enabled` set of variables to enable/disable the navigation at a site, layout, and page level --- and uses that to add search and auxilary links to the `minimal` layout. In addition, it fixes `search-data.json` corruption with default layouts and some minor CSS/SCSS issues.
|
@@ -31,7 +70,7 @@ This release should be a straightforward upgrade for all users of Just the Docs.
|
|
31
70
|
|
32
71
|
### Using Release `v0.9.0`
|
33
72
|
|
34
|
-
Users who have not pinned the theme version will be **automatically upgraded to `v0.
|
73
|
+
Users who have not pinned the theme version will be **automatically upgraded to `v0.9.0` the next time they build their site**.
|
35
74
|
|
36
75
|
To use this release explicitly as a remote theme:
|
37
76
|
|
@@ -601,7 +640,7 @@ We're so excited to release Just the Docs `v0.4.0`. This release has been almost
|
|
601
640
|
- [callouts](https://just-the-docs.com/docs/ui-components/callouts/), a new design component to highlight content
|
602
641
|
- [configuring mermaid.js](https://just-the-docs.com/docs/ui-components/code/#mermaid-diagram-code-blocks), a markdown-native diagram visualization library
|
603
642
|
- [copy code button](https://just-the-docs.com/docs/ui-components/code/#copy-button) for code snippets
|
604
|
-
-
|
643
|
+
- external navigation links
|
605
644
|
- major improvements to nav generation efficiency and robustness
|
606
645
|
- minor improvements to built-in accessibility (SVG icons, nav titles, skip to main content)
|
607
646
|
- [modularized site components](https://just-the-docs.com/docs/customization/#custom-layouts-and-includes) (advanced feature)
|
@@ -1,144 +1,96 @@
|
|
1
1
|
{%- comment -%}
|
2
2
|
Include as: {%- include components/breadcrumbs.html -%}
|
3
3
|
Depends on: page, site.
|
4
|
+
Includes: components/site_nav.html.
|
4
5
|
Results in: HTML for the breadcrumbs component.
|
5
6
|
Overwrites:
|
6
|
-
|
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.
|
7
10
|
{%- endcomment -%}
|
8
11
|
|
9
|
-
{%- if page.url != "/" and page.parent -%}
|
12
|
+
{%- if page.url != "/" and page.parent and page.title -%}
|
10
13
|
|
11
14
|
{%- capture nav_list_link -%}
|
12
15
|
<a href="{{ page.url | relative_url }}" class="nav-list-link">
|
13
16
|
{%- endcapture -%}
|
14
17
|
|
15
18
|
{%- capture site_nav -%}
|
16
|
-
{%- include_cached components/site_nav.html -%}
|
19
|
+
{%- include_cached components/site_nav.html all=true -%}
|
17
20
|
{%- endcapture -%}
|
18
21
|
|
19
|
-
{%-
|
20
|
-
|
21
|
-
|
22
|
-
<ul class="nav-list">
|
23
|
-
{%- endcapture -%}
|
24
|
-
|
25
|
-
{%- capture nav_list_link_class %} class="nav-list-link">
|
26
|
-
{%- endcapture -%}
|
27
|
-
|
28
|
-
{%- capture nav_category -%}
|
29
|
-
<div class="nav-category">
|
30
|
-
{%- endcapture -%}
|
31
|
-
|
32
|
-
{%- assign nav_anchor_splits =
|
33
|
-
site_nav | split: nav_list_link |
|
34
|
-
first | split: nav_category |
|
35
|
-
last | split: "</a>" -%}
|
36
|
-
|
37
|
-
{%- comment -%}
|
38
|
-
The ordinary pages (if any) and the collections pages (if any) are separated by
|
39
|
-
occurrences of nav_category.
|
40
|
-
|
41
|
-
Any ancestor nav-links of the page are contained in the last group of pages,
|
42
|
-
immediately preceding nav-lists. After splitting at "</a>", the anchor that
|
43
|
-
was split is a potential ancestor link when the following split starts with
|
44
|
-
a nav-list.
|
45
|
-
|
46
|
-
The array nav_breadcrumbs is the stack of current potential ancestors of the
|
47
|
-
current page. A split that contains one or more "</ul>"s requires that number
|
48
|
-
of potential ancestors to be popped from the stack.
|
49
|
-
|
50
|
-
The number of occurrences of a string in nav_split_next is computed by removing
|
51
|
-
them all, then dividing the resulting size difference by the length of the string.
|
52
|
-
{%- endcomment %}
|
53
|
-
|
54
|
-
{%- assign nav_breadcrumbs = "" | split: "" -%}
|
55
|
-
|
56
|
-
{%- for nav_split in nav_anchor_splits -%}
|
57
|
-
{%- unless forloop.last -%}
|
58
|
-
|
59
|
-
{%- assign nav_split_next = nav_anchor_splits[forloop.index] | strip -%}
|
60
|
-
|
61
|
-
{%- assign nav_split_test =
|
62
|
-
nav_split_next | remove_first: nav_list_simple | prepend: nav_list_simple -%}
|
63
|
-
{%- if nav_split_test == nav_split_next -%}
|
64
|
-
{%- assign nav_breadcrumb_link =
|
65
|
-
nav_split | split: "<a " | last | prepend: "<a " |
|
66
|
-
replace: nav_list_link_class, ">" | append: "</a>" -%}
|
67
|
-
{%- assign nav_breadcrumbs = nav_breadcrumbs | push: nav_breadcrumb_link -%}
|
68
|
-
{%- endif -%}
|
69
|
-
|
70
|
-
{%- if nav_split_next contains "</ul>" -%}
|
71
|
-
{%- assign nav_list_end_less = nav_split_next | remove: "</ul>" -%}
|
72
|
-
{%- assign nav_list_end_count =
|
73
|
-
nav_split_next.size | minus: nav_list_end_less.size | divided_by: 5 -%}
|
74
|
-
{% for nav_end_index in (1..nav_list_end_count) %}
|
75
|
-
{%- assign nav_breadcrumbs = nav_breadcrumbs | pop -%}
|
76
|
-
{%- endfor -%}
|
77
|
-
{%- endif -%}
|
78
|
-
|
79
|
-
{%- endunless -%}
|
80
|
-
{%- endfor -%}
|
22
|
+
{%- capture nav_list_simple -%}
|
23
|
+
<ul class="nav-list">
|
24
|
+
{%- endcapture -%}
|
81
25
|
|
82
|
-
|
83
|
-
|
26
|
+
{%- capture nav_list_link_class %} class="nav-list-link">
|
27
|
+
{%- endcapture -%}
|
84
28
|
|
85
|
-
{%-
|
29
|
+
{%- capture nav_category -%}
|
30
|
+
<div class="nav-category">
|
31
|
+
{%- endcapture -%}
|
86
32
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
inefficient in Jekyll 3 (also when the for-loop is replaced by where-filters).
|
92
|
-
{%- endcomment -%}
|
33
|
+
{%- assign nav_anchor_splits =
|
34
|
+
site_nav | split: nav_list_link |
|
35
|
+
first | split: nav_category |
|
36
|
+
last | split: "</a>" -%}
|
93
37
|
|
94
|
-
|
38
|
+
{%- comment -%}
|
39
|
+
The ordinary pages (if any) and the collections pages (if any) are separated by
|
40
|
+
occurrences of nav_category.
|
95
41
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
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.
|
100
50
|
|
101
|
-
|
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 %}
|
102
54
|
|
103
|
-
|
104
|
-
{%- assign parent_page = node -%}
|
105
|
-
{%- endif -%}
|
106
|
-
{%- if node.title == page.grand_parent -%}
|
107
|
-
{%- assign grandparent_page = node -%}
|
108
|
-
{%- endif -%}
|
109
|
-
{%- if parent_page and grandparent_page -%}
|
110
|
-
{%- break -%}
|
111
|
-
{%- endif -%}
|
55
|
+
{%- assign nav_breadcrumbs = "" | split: "" -%}
|
112
56
|
|
113
|
-
|
57
|
+
{%- for nav_split in nav_anchor_splits -%}
|
58
|
+
{%- unless forloop.last -%}
|
114
59
|
|
115
|
-
|
116
|
-
{%- break -%}
|
60
|
+
{%- assign nav_split_next = nav_anchor_splits[forloop.index] | strip -%}
|
117
61
|
|
118
|
-
|
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 -%}
|
119
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 -%}
|
120
77
|
{%- endfor -%}
|
121
|
-
|
122
|
-
{%- capture nav_parent_link -%}
|
123
|
-
<a href="{{ parent_page.url | relative_url }}">{{ page.parent }}</a>
|
124
|
-
{%- endcapture -%}
|
125
|
-
|
126
|
-
{%- if page.grand_parent %}
|
127
|
-
{%- capture nav_grandparent_link -%}
|
128
|
-
<a href="{{ grandparent_page.url | relative_url }}">{{ page.grand_parent }}</a>
|
129
|
-
{%- endcapture -%}
|
130
|
-
{%- endif -%}
|
131
|
-
|
132
78
|
{%- endif -%}
|
133
79
|
|
80
|
+
{%- endunless -%}
|
81
|
+
{%- endfor -%}
|
82
|
+
|
134
83
|
<nav aria-label="Breadcrumb" class="breadcrumb-nav">
|
135
84
|
<ol class="breadcrumb-nav-list">
|
136
|
-
|
137
|
-
<li class="breadcrumb-nav-list-item">{{
|
138
|
-
|
139
|
-
<li class="breadcrumb-nav-list-item">{{ nav_parent_link }}</li>
|
85
|
+
{%- for nav_breadcrumb in nav_breadcrumbs %}
|
86
|
+
<li class="breadcrumb-nav-list-item">{{ nav_breadcrumb }}</li>
|
87
|
+
{%- endfor %}
|
140
88
|
<li class="breadcrumb-nav-list-item"><span>{{ page.title }}</span></li>
|
141
89
|
</ol>
|
142
90
|
</nav>
|
143
91
|
|
92
|
+
{% if site.nav_error_report %}
|
93
|
+
{{ nav_error_report }}
|
94
|
+
{% endif %}
|
95
|
+
|
144
96
|
{%- endif -%}
|
@@ -1,33 +1,89 @@
|
|
1
1
|
{%- comment -%}
|
2
2
|
Include as: {%- include components/children_nav.html -%}
|
3
|
-
Depends on: page, site.
|
3
|
+
Depends on: page, site, nav_breadcrumbs.
|
4
4
|
Results in: HTML for the children-navigation component.
|
5
|
-
Includes:
|
6
|
-
sorted_pages.html
|
7
|
-
toc_heading_custom.html
|
5
|
+
Includes: components/nav/sorted.html, toc_heading_custom.html.
|
8
6
|
Overwrites:
|
9
|
-
|
7
|
+
nav_ancestor_links, nav_top_node_titles, nav_child_candidates, nav_children,
|
8
|
+
nav_child, nav_child_ok, nav_child_ancestor, nav_sorted.
|
10
9
|
{%- endcomment -%}
|
11
10
|
|
12
|
-
{%-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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 -%}
|
17
16
|
|
18
|
-
|
17
|
+
{%- if page.has_children == false -%}
|
18
|
+
{%- assign nav_children = "" | split: "" -%}
|
19
|
+
{%- else -%}
|
19
20
|
|
20
|
-
{%-
|
21
|
-
|
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: "" -%}
|
22
44
|
{%- endif -%}
|
45
|
+
|
23
46
|
{%- endif -%}
|
24
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
|
+
|
25
79
|
<hr>
|
26
80
|
{% include toc_heading_custom.html %}
|
27
81
|
<ul>
|
28
|
-
{% for
|
82
|
+
{% for nav_child in nav_children %}
|
29
83
|
<li>
|
30
|
-
<a href="{{
|
84
|
+
<a href="{{ nav_child.url | relative_url }}">{{ nav_child.title }}</a>{% if nav_child.summary %} - {{ nav_child.summary }}{% endif %}
|
31
85
|
</li>
|
32
|
-
{% endfor %}
|
86
|
+
{% endfor %}
|
33
87
|
</ul>
|
88
|
+
|
89
|
+
{%- endif -%}
|
@@ -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,0 +1,53 @@
|
|
1
|
+
{%- comment -%}
|
2
|
+
Include as: {%- include components/nav/links.html pages=page_array ancestors=title_array all=bool -%}
|
3
|
+
Depends on: include.pages, include.ancestors, include.all.
|
4
|
+
Results in: HTML for the main navigation when all is nil or false;
|
5
|
+
includes links to pages excluded from the main navigation when all is true.
|
6
|
+
Includes: components/nav/sorted.html, components/nav/children.html, components/nav/links.html.
|
7
|
+
Overwrites:
|
8
|
+
node, nav_children, nav_ancestors.
|
9
|
+
{%- endcomment -%}
|
10
|
+
|
11
|
+
<ul class="nav-list">
|
12
|
+
{%- for node in include.pages -%}
|
13
|
+
{%- if include.all == true or node.nav_exclude != true -%}
|
14
|
+
|
15
|
+
{%- if include.ancestors contains node.title -%}
|
16
|
+
|
17
|
+
<li class="nav-list-item">
|
18
|
+
<a href="{{ node.url | relative_url }}" class="nav-list-link"> ∞ </a>
|
19
|
+
</li>
|
20
|
+
{%- capture nav_error_report -%}
|
21
|
+
<blockquote class="warning">
|
22
|
+
A page has the same title as its parent page or one of its ancestral pages!<br>
|
23
|
+
This causes an incorrect link in the main navigation panel.<br>
|
24
|
+
Page title: <code>{{ node.title }}</code>, location: <code>{{ node.path }}</code>.
|
25
|
+
</blockquote>
|
26
|
+
{%- endcapture -%}
|
27
|
+
|
28
|
+
{%- else -%}
|
29
|
+
|
30
|
+
{%- include components/nav/children.html node=node ancestors=include.ancestors all=include.all -%}
|
31
|
+
|
32
|
+
<li class="nav-list-item">
|
33
|
+
{%- if nav_children.size >= 1 -%}
|
34
|
+
<button class="nav-list-expander btn-reset" aria-label="toggle items in {{ node.title }} category" aria-pressed="false">
|
35
|
+
<svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
|
36
|
+
</button>
|
37
|
+
{%- endif -%}
|
38
|
+
<a href="{{ node.url | relative_url }}" class="nav-list-link">{{ node.title }}</a>
|
39
|
+
{%- if nav_children.size >= 1 -%}
|
40
|
+
{%- if node.child_nav_order == 'desc' or node.child_nav_order == 'reversed' -%}
|
41
|
+
{%- assign nav_children = nav_children | reverse -%}
|
42
|
+
{%- endif -%}
|
43
|
+
{%- assign nav_ancestors = include.ancestors | push: node.title -%}
|
44
|
+
{%- include components/nav/links.html pages=nav_children ancestors=nav_ancestors all=include.all -%}
|
45
|
+
{%- endif -%}
|
46
|
+
</li>
|
47
|
+
|
48
|
+
{%- endif -%}
|
49
|
+
|
50
|
+
{%- endif -%}
|
51
|
+
{%- endfor -%}
|
52
|
+
</ul>
|
53
|
+
{%- comment -%}{%- endcomment -%}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
{%- comment -%}
|
2
|
+
Include as: {%- include components/nav/pages.html pages=page_array all=bool -%}
|
3
|
+
Depends on: include.pages.
|
4
|
+
Results in: HTML for the main navigation when all is nil or false;
|
5
|
+
adds links to pages excluded from the main navigation when all is true.
|
6
|
+
Includes: components/nav/links.html
|
7
|
+
Assigns to:
|
8
|
+
nav_parenthood, nav_top_nodes, nav_top_node_titles, nav_ancestors.
|
9
|
+
{%- endcomment -%}
|
10
|
+
|
11
|
+
{%- assign nav_parenthood = include.pages
|
12
|
+
| where_exp: "item", "item.title != nil" | group_by: "parent" -%}
|
13
|
+
|
14
|
+
{%- assign nav_top_nodes = nav_parenthood
|
15
|
+
| where_exp: "item", "item.name == ''" | map: "items" | first -%}
|
16
|
+
|
17
|
+
{%- include components/nav/sorted.html pages=nav_top_nodes -%}
|
18
|
+
|
19
|
+
{% assign nav_top_node_titles = nav_top_nodes | map: "title" -%}
|
20
|
+
|
21
|
+
{%- assign nav_ancestors = "" | split: "" -%}
|
22
|
+
|
23
|
+
{%- include components/nav/links.html pages=nav_sorted ancestors=nav_ancestors all=include.all -%}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
{%- comment -%}
|
2
|
-
Include as: {%- include
|
2
|
+
Include as: {%- include components/nav/sorted.html pages=page_array -%}
|
3
3
|
Depends on: include.pages.
|
4
|
-
Assigns to:
|
4
|
+
Assigns to: nav_sorted.
|
5
5
|
Overwrites:
|
6
6
|
nav_order_pages, title_order_pages, double_quote, empty_array,
|
7
7
|
nav_number_pages, nav_string_pages, nav_order_groups, group,
|
@@ -103,7 +103,7 @@
|
|
103
103
|
{%- endif -%}
|
104
104
|
{%- endunless -%}
|
105
105
|
|
106
|
-
{%- assign
|
106
|
+
{%- assign nav_sorted = nav_number_pages
|
107
107
|
| concat: nav_string_pages
|
108
108
|
| concat: title_number_pages
|
109
109
|
| concat: title_string_pages -%}
|
@@ -1,9 +1,10 @@
|
|
1
1
|
{%- comment -%}
|
2
|
-
Include as: {%- include_cached components/site_nav.html -%}
|
2
|
+
Include as: {%- include_cached components/site_nav.html all=bool -%}
|
3
3
|
Depends on: site.
|
4
|
-
Results in: HTML for the
|
4
|
+
Results in: cached HTML for the main navigation when `all` is nil or false;
|
5
|
+
includes links to pages excluded from the main navigation when `all` is true.
|
5
6
|
Includes:
|
6
|
-
components/nav.html
|
7
|
+
components/nav/pages.html
|
7
8
|
Overwrites:
|
8
9
|
pages_top_size, collections_size, collection_entry,
|
9
10
|
collection_key, collection_value, collection.
|
@@ -16,7 +17,7 @@
|
|
16
17
|
| where_exp:"item", "item.nav_exclude != true"
|
17
18
|
| size %}
|
18
19
|
{% if pages_top_size > 0 %}
|
19
|
-
{% include components/nav.html pages=site.html_pages %}
|
20
|
+
{% include components/nav/pages.html pages=site.html_pages all=include.all %}
|
20
21
|
{% endif %}
|
21
22
|
{%- if site.nav_external_links -%}
|
22
23
|
<ul class="nav-list">
|
@@ -51,17 +52,21 @@
|
|
51
52
|
</button>
|
52
53
|
{%- endif -%}
|
53
54
|
<div class="nav-category">{{ collection_value.name }}</div>
|
54
|
-
{% include components/nav.html pages=collection %}
|
55
|
+
{% include components/nav/pages.html pages=collection all=include.all %}
|
55
56
|
</li>
|
56
57
|
</ul>
|
57
58
|
{% else %}
|
58
59
|
<div class="nav-category">{{ collection_value.name }}</div>
|
59
|
-
{% include components/nav.html pages=collection %}
|
60
|
+
{% include components/nav/pages.html pages=collection all=include.all %}
|
60
61
|
{% endif %}
|
61
62
|
{% else %}
|
62
|
-
{% include components/nav.html pages=collection %}
|
63
|
+
{% include components/nav/pages.html pages=collection all=include.all %}
|
63
64
|
{% endif %}
|
64
65
|
{% endif %}
|
65
66
|
{% endfor %}
|
66
67
|
{% endif %}
|
67
68
|
</nav>
|
69
|
+
|
70
|
+
{% if site.nav_error_report %}
|
71
|
+
{{ nav_error_report }}
|
72
|
+
{%- endif %}
|
@@ -21,18 +21,18 @@
|
|
21
21
|
{%- endcomment -%}
|
22
22
|
|
23
23
|
{%- capture activation_no_nav_link %}
|
24
|
-
.site-nav ul li a {
|
25
|
-
|
26
|
-
}
|
27
|
-
|
28
|
-
{%- if site.just_the_docs.collections %}
|
29
|
-
.site-nav > ul.nav-category-list > li > button svg {
|
30
|
-
|
31
|
-
}
|
32
|
-
.site-nav > ul.nav-category-list > li.nav-list-item > ul.nav-list {
|
33
|
-
|
34
|
-
}
|
35
|
-
{%- endif %}
|
24
|
+
.site-nav ul li a {
|
25
|
+
background-image: none;
|
26
|
+
}
|
27
|
+
|
28
|
+
{%- if site.just_the_docs.collections %}
|
29
|
+
.site-nav > ul.nav-category-list > li > button svg {
|
30
|
+
transform: rotate(-90deg);
|
31
|
+
}
|
32
|
+
.site-nav > ul.nav-category-list > li.nav-list-item > ul.nav-list {
|
33
|
+
display: block;
|
34
|
+
}
|
35
|
+
{%- endif %}
|
36
36
|
{% endcapture -%}
|
37
37
|
|
38
38
|
{%- capture nav_list_link -%}
|
@@ -45,288 +45,281 @@
|
|
45
45
|
|
46
46
|
{%- if site_nav contains nav_list_link -%}
|
47
47
|
|
48
|
-
{%- capture nav_list -%}
|
49
|
-
<ul class="nav-list
|
50
|
-
{%- endcapture -%}
|
48
|
+
{%- capture nav_list -%}
|
49
|
+
<ul class="nav-list
|
50
|
+
{%- endcapture -%}
|
51
51
|
|
52
|
-
{%- assign nav_list_end = "</ul>" -%}
|
52
|
+
{%- assign nav_list_end = "</ul>" -%}
|
53
53
|
|
54
|
-
{%- capture nav_list_item -%}
|
55
|
-
<li class="nav-list-item
|
56
|
-
{%- endcapture -%}
|
54
|
+
{%- capture nav_list_item -%}
|
55
|
+
<li class="nav-list-item
|
56
|
+
{%- endcapture -%}
|
57
57
|
|
58
|
-
{%- capture nav_category_list -%}
|
59
|
-
<ul class="nav-list nav-category-list">
|
60
|
-
{%- endcapture -%}
|
58
|
+
{%- capture nav_category_list -%}
|
59
|
+
<ul class="nav-list nav-category-list">
|
60
|
+
{%- endcapture -%}
|
61
61
|
|
62
|
-
{%- assign nav_list_link_prefix =
|
63
|
-
|
62
|
+
{%- assign nav_list_link_prefix =
|
63
|
+
site_nav | split: nav_list_link | first | append: nav_list_link -%}
|
64
64
|
|
65
|
-
{%- assign nav_splits =
|
66
|
-
|
65
|
+
{%- assign nav_splits =
|
66
|
+
nav_list_link_prefix | split: nav_list_item | pop -%}
|
67
67
|
|
68
|
-
{%- assign nav_levels = "" | split: "" | push: 1 -%}
|
68
|
+
{%- assign nav_levels = "" | split: "" | push: 1 -%}
|
69
69
|
|
70
|
-
{%- comment -%}
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
site_nav = PAGES? EXTERNALS? COLLECTION*
|
75
|
-
|
76
|
-
PAGES = nav_list (nav_list_item PAGES?)+ nav_list_end
|
77
|
-
|
78
|
-
EXTERNALS = nav_list nav_list_item+ nav_list_end
|
79
|
-
|
80
|
-
COLLECTION = nav_list (nav_list_item PAGES?)* nav_list_end
|
81
|
-
| nav_category_list
|
82
|
-
nav_list_item nav_list (nav_list_item PAGES?)* nav_list_end
|
83
|
-
nav_list_end
|
84
|
-
|
85
|
-
To determine the path in the site_nav to the nav_list_link for the current page,
|
86
|
-
the prefix of nav_list_link in site_nav is split at each nav_list_item to give
|
87
|
-
an array of nav_splits.
|
88
|
-
|
89
|
-
In site_nav, occurrences of nav_list must be separated by at least one
|
90
|
-
nav_list_item or nav_list_end. Moreover, when a nav_list_end is followed by a
|
91
|
-
nav_list without an intervening nav_list_item, that nav_list must start either
|
92
|
-
a list of external links or a collection. And when a nav_list is followed by a
|
93
|
-
nav_list_end without an intervening nav_list_item, they form an empty collection.
|
94
|
-
|
95
|
-
nav_levels is the path determined by the previously inspected nav_splits.
|
96
|
-
How many times nav_list and nav_list_end occur in the current nav_split
|
97
|
-
determines how to update the path.
|
98
|
-
|
99
|
-
A nav_split can contain any number of empty non-foldable collections.
|
100
|
-
The path element produced by the outer nav_list of a foldable collection is
|
101
|
-
irrelevant; it is set to zero and subsequently removed.
|
102
|
-
|
103
|
-
The number of occurrences of a string in a nav_split is computed by removing
|
104
|
-
them all, then dividing the resulting size difference by the length of the string.
|
105
|
-
|
106
|
-
Case analysis on (nav_list_count, nav_list_end_count):
|
107
|
-
|
108
|
-
- when (0, 0), the nav_split was between two nav_list_items at the same level;
|
109
|
-
|
110
|
-
- when (0, N+1), all the nav_list_ends in the nav_split are in PAGES or in one
|
111
|
-
COLLECTION;
|
70
|
+
{%- comment -%}
|
71
|
+
The pattern of occurrences of list and list-item tags in the site_nav string
|
72
|
+
is included in the language defined by the following context-free grammar:
|
112
73
|
|
113
|
-
|
114
|
-
be separated by at least one nav_list_end);
|
115
|
-
|
116
|
-
- when (M+1, N+1), the nav_split must contain either:
|
117
|
-
- the end of PAGES followed by the start of EXTERNALS, or
|
118
|
-
- the end of PAGES followed by the start of a COLLECTION, or
|
119
|
-
- the end of EXTERNALS followed by the start of a COLLECTION, or
|
120
|
-
- the end of one COLLECTION followed by the start of another, or
|
121
|
-
- (in the first nav_split) one or more empty non-foldable COLLECTIONS
|
122
|
-
followed by the start of a COLLECTION.
|
123
|
-
In general, nav_levels[0] here needs to be incremented by nav_list_count.
|
124
|
-
However, a nav_split that contains the end of an empty foldable collection
|
125
|
-
followed by the just the start of a collection has two occurrences of nav_list,
|
126
|
-
and the increment needs to be one less; similarly when the first nav_split
|
127
|
-
starts with an empty non-foldable collection.
|
128
|
-
{%- endcomment %}
|
129
|
-
|
130
|
-
{%- for nav_split in nav_splits -%}
|
131
|
-
|
132
|
-
{%- assign nav_list_less = nav_split | remove: nav_list -%}
|
133
|
-
{%- assign nav_list_count =
|
134
|
-
nav_split.size | minus: nav_list_less.size |
|
135
|
-
divided_by: nav_list.size -%}
|
136
|
-
|
137
|
-
{%- assign nav_list_end_less = nav_split | remove: nav_list_end -%}
|
138
|
-
{%- assign nav_list_end_count =
|
139
|
-
nav_split.size | minus: nav_list_end_less.size |
|
140
|
-
divided_by: nav_list_end.size -%}
|
141
|
-
|
142
|
-
{%- if nav_list_count == 0 and nav_list_end_count == 0 -%}
|
143
|
-
|
144
|
-
{%- assign nav_index = nav_levels[-1] | plus: 1 -%}
|
145
|
-
{%- assign nav_levels = nav_levels | pop | push: nav_index -%}
|
146
|
-
|
147
|
-
{%- elsif nav_list_count == 0 and nav_list_end_count >= 1 -%}
|
148
|
-
|
149
|
-
{%- assign nav_slice_size = nav_levels.size | minus: nav_list_end_count -%}
|
150
|
-
{%- assign nav_levels = nav_levels | slice: 0, nav_slice_size -%}
|
151
|
-
{%- assign nav_index = nav_levels[-1] | plus: 1 -%}
|
152
|
-
{%- assign nav_levels = nav_levels | pop | push: nav_index -%}
|
153
|
-
|
154
|
-
{%- elsif nav_list_count == 1 and nav_list_end_count == 0 -%}
|
155
|
-
|
156
|
-
{%- if nav_split contains nav_category_list -%}
|
157
|
-
{%- assign nav_levels = nav_levels | push: 0 -%}
|
158
|
-
{%- else -%}
|
159
|
-
{%- assign nav_levels = nav_levels | push: 1 -%}
|
160
|
-
{%- endif -%}
|
161
|
-
|
162
|
-
{%- elsif nav_list_count >= 1 and nav_list_end_count >= 1 -%}
|
163
|
-
|
164
|
-
{%- assign nav_index = nav_levels[0] | plus: nav_list_count -%}
|
165
|
-
{%- if nav_levels[-1] == 0 or forloop.first -%}
|
166
|
-
{%- assign nav_index = nav_index | minus: 1 -%}
|
167
|
-
{%- endif -%}
|
168
|
-
{%- assign nav_levels = nav_levels | slice: 0, 0 | push: nav_index -%}
|
169
|
-
{%- if nav_split contains nav_category_list -%}
|
170
|
-
{%- assign nav_levels = nav_levels | push: 0 -%}
|
171
|
-
{%- else -%}
|
172
|
-
{%- assign nav_levels = nav_levels | push: 1 -%}
|
173
|
-
{%- endif -%}
|
174
|
-
|
175
|
-
{%- endif -%}
|
176
|
-
|
177
|
-
{%- endfor -%}
|
74
|
+
site_nav = PAGES? EXTERNALS? COLLECTION*
|
178
75
|
|
179
|
-
|
76
|
+
PAGES = nav_list (nav_list_item PAGES?)+ nav_list_end
|
180
77
|
|
181
|
-
|
78
|
+
EXTERNALS = nav_list nav_list_item+ nav_list_end
|
182
79
|
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
80
|
+
COLLECTION = nav_list (nav_list_item PAGES?)* nav_list_end
|
81
|
+
| nav_category_list
|
82
|
+
nav_list_item nav_list (nav_list_item PAGES?)* nav_list_end
|
83
|
+
nav_list_end
|
84
|
+
|
85
|
+
To determine the path in the site_nav to the nav_list_link for the current page,
|
86
|
+
the prefix of nav_list_link in site_nav is split at each nav_list_item to give
|
87
|
+
an array of nav_splits.
|
88
|
+
|
89
|
+
In site_nav, occurrences of nav_list must be separated by at least one
|
90
|
+
nav_list_item or nav_list_end. Moreover, when a nav_list_end is followed by a
|
91
|
+
nav_list without an intervening nav_list_item, that nav_list must start either
|
92
|
+
a list of external links or a collection. And when a nav_list is followed by a
|
93
|
+
nav_list_end without an intervening nav_list_item, they form an empty collection.
|
94
|
+
|
95
|
+
nav_levels is the path determined by the previously inspected nav_splits.
|
96
|
+
How many times nav_list and nav_list_end occur in the current nav_split
|
97
|
+
determines how to update the path.
|
98
|
+
|
99
|
+
A nav_split can contain any number of empty non-foldable collections.
|
100
|
+
The path element produced by the outer nav_list of a foldable collection is
|
101
|
+
irrelevant; it is set to zero and subsequently removed.
|
102
|
+
|
103
|
+
The number of occurrences of a string in a nav_split is computed by removing
|
104
|
+
them all, then dividing the resulting size difference by the length of the string.
|
105
|
+
|
106
|
+
Case analysis on (nav_list_count, nav_list_end_count):
|
107
|
+
|
108
|
+
- when (0, 0), the nav_split was between two nav_list_items at the same level;
|
109
|
+
|
110
|
+
- when (0, N+1), all the nav_list_ends in the nav_split are in PAGES or in one
|
111
|
+
COLLECTION;
|
112
|
+
|
113
|
+
- when (M+1, 0), M must be 0 (because two nav_lists in the same nav_split must
|
114
|
+
be separated by at least one nav_list_end);
|
115
|
+
|
116
|
+
- when (M+1, N+1), the nav_split must contain either:
|
117
|
+
- the end of PAGES followed by the start of EXTERNALS, or
|
118
|
+
- the end of PAGES followed by the start of a COLLECTION, or
|
119
|
+
- the end of EXTERNALS followed by the start of a COLLECTION, or
|
120
|
+
- the end of one COLLECTION followed by the start of another, or
|
121
|
+
- (in the first nav_split) one or more empty non-foldable COLLECTIONS
|
122
|
+
followed by the start of a COLLECTION.
|
123
|
+
In general, nav_levels[0] here needs to be incremented by nav_list_count.
|
124
|
+
However, a nav_split that contains the end of an empty foldable collection
|
125
|
+
followed by the just the start of a collection has two occurrences of nav_list,
|
126
|
+
and the increment needs to be one less; similarly when the first nav_split
|
127
|
+
starts with an empty non-foldable collection.
|
128
|
+
{%- endcomment %}
|
129
|
+
|
130
|
+
{%- for nav_split in nav_splits -%}
|
131
|
+
|
132
|
+
{%- assign nav_list_less = nav_split | remove: nav_list -%}
|
133
|
+
{%- assign nav_list_count =
|
134
|
+
nav_split.size | minus: nav_list_less.size |
|
135
|
+
divided_by: nav_list.size -%}
|
136
|
+
|
137
|
+
{%- assign nav_list_end_less = nav_split | remove: nav_list_end -%}
|
138
|
+
{%- assign nav_list_end_count =
|
139
|
+
nav_split.size | minus: nav_list_end_less.size |
|
140
|
+
divided_by: nav_list_end.size -%}
|
141
|
+
|
142
|
+
{%- if nav_list_count == 0 and nav_list_end_count == 0 -%}
|
143
|
+
|
144
|
+
{%- assign nav_index = nav_levels[-1] | plus: 1 -%}
|
145
|
+
{%- assign nav_levels = nav_levels | pop | push: nav_index -%}
|
146
|
+
|
147
|
+
{%- elsif nav_list_count == 0 and nav_list_end_count >= 1 -%}
|
148
|
+
|
149
|
+
{%- assign nav_slice_size = nav_levels.size | minus: nav_list_end_count -%}
|
150
|
+
{%- assign nav_levels = nav_levels | slice: 0, nav_slice_size -%}
|
151
|
+
{%- assign nav_index = nav_levels[-1] | plus: 1 -%}
|
152
|
+
{%- assign nav_levels = nav_levels | pop | push: nav_index -%}
|
153
|
+
|
154
|
+
{%- elsif nav_list_count == 1 and nav_list_end_count == 0 -%}
|
155
|
+
|
156
|
+
{%- if nav_split contains nav_category_list -%}
|
157
|
+
{%- assign nav_levels = nav_levels | push: 0 -%}
|
158
|
+
{%- else -%}
|
159
|
+
{%- assign nav_levels = nav_levels | push: 1 -%}
|
160
|
+
{%- endif -%}
|
161
|
+
|
162
|
+
{%- elsif nav_list_count >= 1 and nav_list_end_count >= 1 -%}
|
163
|
+
|
164
|
+
{%- assign nav_index = nav_levels[0] | plus: nav_list_count -%}
|
165
|
+
{%- if nav_levels[-1] == 0 or forloop.first -%}
|
166
|
+
{%- assign nav_index = nav_index | minus: 1 -%}
|
167
|
+
{%- endif -%}
|
168
|
+
{%- assign nav_levels = nav_levels | slice: 0, 0 | push: nav_index -%}
|
169
|
+
{%- if nav_split contains nav_category_list -%}
|
170
|
+
{%- assign nav_levels = nav_levels | push: 0 -%}
|
171
|
+
{%- else -%}
|
172
|
+
{%- assign nav_levels = nav_levels | push: 1 -%}
|
173
|
+
{%- endif -%}
|
187
174
|
|
188
|
-
{%-
|
175
|
+
{%- endif -%}
|
189
176
|
|
190
|
-
{
|
177
|
+
{%- endfor -%}
|
191
178
|
|
192
|
-
{%-
|
179
|
+
{%- assign nav_levels = nav_levels | where_exp: "item", "item >= 1" -%}
|
193
180
|
|
194
|
-
{%-
|
181
|
+
{%- comment -%}
|
182
|
+
The generated CSS depends on the position of the current page in each level in
|
183
|
+
the navigation.
|
195
184
|
|
196
|
-
|
185
|
+
nav_page_level is the depth of the navigation hierarchy (ignoring collections).
|
186
|
+
In existing 3-level sites, nav_page_level <= 3.
|
187
|
+
In multi-level sites, nav_page_level is unbounded.
|
188
|
+
{%- endcomment -%}
|
197
189
|
|
198
|
-
{%-
|
190
|
+
{%- assign nav_page_level = nav_levels.size | minus: 1 -%}
|
191
|
+
{%- assign nav_page_parent_level = nav_page_level | minus: 1 -%}
|
192
|
+
{%- assign nav_page_grandparent_level = nav_page_level | minus: 2 -%}
|
199
193
|
|
200
|
-
{%- comment -%}
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
- a ul.nav-list with li.nav-list-items for its top-level pages
|
209
|
-
|
210
|
-
A foldable collection is:
|
211
|
-
- a ul.nav-list.nav-category-list with a single li.nav-list-item containing:
|
212
|
-
- an optional button with the expander svg
|
213
|
-
- a div.nav-category with the collection name
|
194
|
+
{%- comment -%}
|
195
|
+
The site-nav is:
|
196
|
+
- an optional ul.nav-list with li.nav-list-items for non-collection top-level pages
|
197
|
+
- an optional ul.nav-list with li.nav-list-item.externals
|
198
|
+
- any number of just-the-docs.collections
|
199
|
+
|
200
|
+
A non-foldable collection is:
|
201
|
+
- a div.nav-category with the collection name, followed by:
|
214
202
|
- a ul.nav-list with li.nav-list-items for its top-level pages
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
{%-
|
226
|
-
|
227
|
-
{%- capture activation_other_collection_prefix -%}
|
228
|
-
.site-nav > ul.nav-list:not(:first-child)
|
229
|
-
{%- endcapture -%}
|
203
|
+
|
204
|
+
A foldable collection is:
|
205
|
+
- a ul.nav-list.nav-category-list with a single li.nav-list-item containing:
|
206
|
+
- an optional button with the expander svg
|
207
|
+
- a div.nav-category with the collection name
|
208
|
+
- a ul.nav-list with li.nav-list-items for its top-level pages
|
209
|
+
|
210
|
+
The generated CSS uses:
|
211
|
+
- activation_collection_prefix, to select the site-nav > ul.nav-list for the page
|
212
|
+
- activation_other_collection_prefix, to select all the other site-nav > ul.nav-lists
|
213
|
+
{%- endcomment -%}
|
230
214
|
|
231
|
-
{%-
|
215
|
+
{%- if page.collection == nil -%}
|
232
216
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
{%- endif -%}
|
237
|
-
{%- endcapture -%}
|
238
|
-
|
239
|
-
{%- capture activation_other_collection_prefix -%}
|
240
|
-
.site-nav > ul:not(:nth-of-type({{ nav_levels[0] }}))
|
241
|
-
{%- endcapture -%}
|
217
|
+
{%- capture activation_collection_prefix -%}
|
218
|
+
.site-nav > ul.nav-list:first-child
|
219
|
+
{%- endcapture -%}
|
242
220
|
|
243
|
-
{%-
|
221
|
+
{%- capture activation_other_collection_prefix -%}
|
222
|
+
.site-nav > ul.nav-list:not(:first-child)
|
223
|
+
{%- endcapture -%}
|
244
224
|
|
245
|
-
{%-
|
246
|
-
The required background image of the link to the current page may involve SCSS.
|
247
|
-
To avoid page-dependent SCSS, all nav links initially have that background image.
|
248
|
-
The following rule removes the image from the links to all parents, siblings,
|
249
|
-
and children of the current page.
|
250
|
-
{%- endcomment %}
|
225
|
+
{%- else -%}
|
251
226
|
|
252
|
-
{
|
227
|
+
{%- capture activation_collection_prefix -%}
|
228
|
+
.site-nav > ul:nth-of-type({{ nav_levels[0] }})
|
229
|
+
{%- if site.just_the_docs.collections[page.collection].nav_fold %} > li > ul
|
230
|
+
{%- endif -%}
|
231
|
+
{%- endcapture -%}
|
253
232
|
|
254
|
-
{
|
255
|
-
{{
|
256
|
-
{
|
257
|
-
background-image: none;
|
258
|
-
}
|
233
|
+
{%- capture activation_other_collection_prefix -%}
|
234
|
+
.site-nav > ul:not(:nth-of-type({{ nav_levels[0] }}))
|
235
|
+
{%- endcapture -%}
|
259
236
|
|
260
|
-
{%-
|
237
|
+
{%- endif -%}
|
261
238
|
|
262
|
-
{
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
239
|
+
{%- comment -%}
|
240
|
+
The required background image of the link to the current page may involve SCSS.
|
241
|
+
To avoid page-dependent SCSS, all nav links initially have that background image.
|
242
|
+
The following rule removes the image from the links to all parents, siblings,
|
243
|
+
and children of the current page.
|
244
|
+
{%- endcomment %}
|
245
|
+
|
246
|
+
{% if nav_page_level >= 2 -%}
|
247
|
+
{%- for i in (1..nav_page_parent_level) -%}
|
248
|
+
{{ activation_collection_prefix }} >
|
249
|
+
{%- for j in (2..i) %} li > ul >
|
250
|
+
{%- endfor %} li > a,
|
251
|
+
{% endfor -%}
|
252
|
+
{%- endif %}
|
253
|
+
{{ activation_collection_prefix }} >
|
254
|
+
{%- for i in (1..nav_page_parent_level) %} li > ul >
|
255
|
+
{%- endfor %} li:not(:nth-child({{ nav_levels[nav_page_level] }})) > a,
|
256
|
+
{{ activation_collection_prefix }} >
|
257
|
+
{%- for i in (1..nav_page_level) %} li > ul >
|
258
|
+
{%- endfor %} li a {
|
259
|
+
background-image: none;
|
260
|
+
}
|
261
|
+
|
262
|
+
{%- comment -%}
|
263
|
+
The following rule removes the image from the links to pages in other collections.
|
264
|
+
{%- endcomment %}
|
265
|
+
|
266
|
+
{{ activation_other_collection_prefix }} a,
|
267
|
+
.site-nav li.external a {
|
268
|
+
background-image: none;
|
269
|
+
}
|
270
|
+
|
271
|
+
{%- comment -%}
|
272
|
+
The following rule styles the link to the current page.
|
273
|
+
{%- endcomment %}
|
274
|
+
|
275
|
+
{{ activation_collection_prefix }} > li:nth-child({{ nav_levels[1] }})
|
276
|
+
{%- for i in (2..nav_page_level) %} > ul > li:nth-child({{ nav_levels[i] }})
|
277
|
+
{%- endfor %} > a {
|
278
|
+
font-weight: 600;
|
279
|
+
text-decoration: none;
|
280
|
+
}
|
281
|
+
|
282
|
+
{%- comment -%}
|
283
|
+
The following rules unfold all collections, and display the links to any children
|
284
|
+
of the current page.
|
285
|
+
|
286
|
+
To avoid dependence on the SCSS variable nav-list-expander-right, the direction
|
287
|
+
of the rotation of the expander icon is fixed, and corresponds to the appearance
|
288
|
+
when nav-list-expander-right is true. This results in a minor visual difference
|
289
|
+
between the appearance of active expander icons when JS is enabled/disabled and
|
290
|
+
nav-list-expander-right is false, which seems unavoidable.
|
291
|
+
{%- endcomment %}
|
292
|
+
|
293
|
+
{%- if site.just_the_docs.collections %}
|
294
|
+
.site-nav > ul.nav-category-list > li > button svg,
|
295
|
+
{% endif -%}
|
296
|
+
{{ activation_collection_prefix }} > li:nth-child({{ nav_levels[1] }}) > button svg
|
297
|
+
{%- for i in (2..nav_page_level) %},
|
298
|
+
{{ activation_collection_prefix }} > li:nth-child({{ nav_levels[1] }}) >
|
299
|
+
{%- for j in (2..i) %} ul > li:nth-child({{ nav_levels[j] }}) >
|
300
|
+
{%- endfor %} button svg
|
301
|
+
{%- endfor %} {
|
302
|
+
transform: rotate(-90deg);
|
303
|
+
}
|
304
|
+
|
305
|
+
{%- if site.just_the_docs.collections %}
|
306
|
+
.site-nav > ul.nav-category-list > li.nav-list-item > ul.nav-list,
|
307
|
+
{% endif -%}
|
308
|
+
{{ activation_collection_prefix }} > li.nav-list-item:nth-child({{ nav_levels[1] }}) > ul.nav-list
|
309
|
+
{%- for i in (2..nav_page_level) %},
|
310
|
+
{{ activation_collection_prefix }} > li.nav-list-item:nth-child({{ nav_levels[1] }}) >
|
311
|
+
{%- for j in (2..i) %} ul.nav-list > li.nav-list-item:nth-child({{ nav_levels[j] }}) >
|
312
|
+
{%- endfor %} ul.nav-list
|
313
|
+
{%- endfor %} {
|
314
|
+
display: block;
|
315
|
+
}
|
267
316
|
|
268
317
|
{%- else -%}
|
269
318
|
|
270
|
-
{
|
271
|
-
|
272
|
-
{
|
273
|
-
background-image: none;
|
274
|
-
}
|
275
|
-
|
276
|
-
{%- endif %}
|
277
|
-
|
278
|
-
{%- comment -%}
|
279
|
-
The following rule removes the image from the links to pages in other collections.
|
280
|
-
{%- endcomment %}
|
319
|
+
{%- comment -%}
|
320
|
+
not site_nav contains nav_list_link
|
321
|
+
{%- endcomment -%}
|
281
322
|
|
282
|
-
{{
|
283
|
-
.site-nav li.external a {
|
284
|
-
background-image: none;
|
285
|
-
}
|
323
|
+
{{ activation_no_nav_link }}
|
286
324
|
|
287
|
-
{%- comment -%}
|
288
|
-
The following rule styles the link to the current page.
|
289
|
-
{%- endcomment %}
|
290
|
-
|
291
|
-
{{ activation_collection_prefix }} > li:nth-child({{ nav_levels[1] }})
|
292
|
-
{%- if nav_levels[2] %} > ul > li:nth-child({{ nav_levels[2] }})
|
293
|
-
{%- if nav_levels[3] %} > ul > li:nth-child({{ nav_levels[3] }})
|
294
|
-
{%- endif -%}
|
295
|
-
{%- endif %} > a {
|
296
|
-
font-weight: 600;
|
297
|
-
text-decoration: none;
|
298
|
-
}
|
299
|
-
|
300
|
-
{%- comment -%}
|
301
|
-
The following rules unfold all collections, and display the links to any children
|
302
|
-
of the current page.
|
303
|
-
|
304
|
-
To avoid dependence on the SCSS variable nav-list-expander-right, the direction
|
305
|
-
of the rotation of the expander icon is fixed, and corresponds to the appearance
|
306
|
-
when nav-list-expander-right is true. This results in a minor visual difference
|
307
|
-
between the appearance of active expander icons when JS is enabled/disabled and
|
308
|
-
nav-list-expander-right is false, which seems unavoidable.
|
309
|
-
{%- endcomment %}
|
310
|
-
|
311
|
-
{%- if site.just_the_docs.collections %}
|
312
|
-
.site-nav > ul.nav-category-list > li > button svg,
|
313
|
-
{% endif -%}
|
314
|
-
{{ activation_collection_prefix }} > li:nth-child({{ nav_levels[1] }}) > button svg
|
315
|
-
{%- if nav_levels[2] -%},
|
316
|
-
{{ activation_collection_prefix }} > li:nth-child({{ nav_levels[1] }}) > ul > li:nth-child({{ nav_levels[2] }}) > button svg
|
317
|
-
{%- endif %} {
|
318
|
-
transform: rotate(-90deg);
|
319
|
-
}
|
320
|
-
|
321
|
-
{%- if site.just_the_docs.collections %}
|
322
|
-
.site-nav > ul.nav-category-list > li.nav-list-item > ul.nav-list,
|
323
|
-
{% endif -%}
|
324
|
-
{{ activation_collection_prefix }} > li.nav-list-item:nth-child({{ nav_levels[1] }}) > ul.nav-list
|
325
|
-
{%- if nav_levels[2] %},
|
326
|
-
{{ activation_collection_prefix }} > li.nav-list-item:nth-child({{ nav_levels[1] }}) > ul.nav-list > li.nav-list-item:nth-child({{ nav_levels[2] }}) > ul.nav-list
|
327
|
-
{%- endif %} {
|
328
|
-
display: block;
|
329
|
-
}
|
330
|
-
|
331
|
-
{%- endif -%}
|
332
325
|
{%- endif -%}
|
data/_layouts/default.html
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: just-the-docs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.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: 2024-
|
12
|
+
date: 2024-09-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -100,7 +100,10 @@ files:
|
|
100
100
|
- _includes/components/footer.html
|
101
101
|
- _includes/components/header.html
|
102
102
|
- _includes/components/mermaid.html
|
103
|
-
- _includes/components/nav.html
|
103
|
+
- _includes/components/nav/children.html
|
104
|
+
- _includes/components/nav/links.html
|
105
|
+
- _includes/components/nav/pages.html
|
106
|
+
- _includes/components/nav/sorted.html
|
104
107
|
- _includes/components/search_footer.html
|
105
108
|
- _includes/components/search_header.html
|
106
109
|
- _includes/components/sidebar.html
|
@@ -129,7 +132,6 @@ files:
|
|
129
132
|
- _includes/mermaid_config.js
|
130
133
|
- _includes/nav_footer_custom.html
|
131
134
|
- _includes/search_placeholder_custom.html
|
132
|
-
- _includes/sorted_pages.html
|
133
135
|
- _includes/title.html
|
134
136
|
- _includes/toc_heading_custom.html
|
135
137
|
- _includes/vendor/anchor_headings.html
|
@@ -1,75 +0,0 @@
|
|
1
|
-
{%- comment -%}
|
2
|
-
Include as: {%- include components/nav.html pages=pages -%}
|
3
|
-
Depends on: include.pages.
|
4
|
-
Results in: HTML for the navigation panel.
|
5
|
-
Includes:
|
6
|
-
sorted_pages.html
|
7
|
-
Overwrites:
|
8
|
-
nav_pages, first_level_pages, second_level_pages, third_level_pages,
|
9
|
-
node, children_list, child, grand_children_list, grand_child.
|
10
|
-
{%- endcomment -%}
|
11
|
-
|
12
|
-
{%- assign nav_pages = include.pages
|
13
|
-
| where_exp: "item", "item.title != nil"
|
14
|
-
| where_exp: "item", "item.nav_exclude != true" -%}
|
15
|
-
|
16
|
-
{%- include sorted_pages.html pages = nav_pages -%}
|
17
|
-
|
18
|
-
{%- comment -%}
|
19
|
-
It might be more efficient to sort the pages at each level separately.
|
20
|
-
{%- endcomment -%}
|
21
|
-
|
22
|
-
{%- assign first_level_pages = sorted_pages
|
23
|
-
| where_exp: "item", "item.parent == nil" -%}
|
24
|
-
{%- assign second_level_pages = sorted_pages
|
25
|
-
| where_exp: "item", "item.parent != nil"
|
26
|
-
| where_exp: "item", "item.grand_parent == nil" -%}
|
27
|
-
{%- assign third_level_pages = sorted_pages
|
28
|
-
| where_exp: "item", "item.grand_parent != nil" -%}
|
29
|
-
|
30
|
-
<ul class="nav-list">
|
31
|
-
{%- for node in first_level_pages -%}
|
32
|
-
<li class="nav-list-item">
|
33
|
-
{%- if node.has_children -%}
|
34
|
-
<button class="nav-list-expander btn-reset" aria-label="toggle items in {{ node.title }} category" aria-pressed="false">
|
35
|
-
<svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
|
36
|
-
</button>
|
37
|
-
{%- endif -%}
|
38
|
-
<a href="{{ node.url | relative_url }}" class="nav-list-link">{{ node.title }}</a>
|
39
|
-
{%- if node.has_children -%}
|
40
|
-
{%- assign children_list = second_level_pages
|
41
|
-
| where: "parent", node.title -%}
|
42
|
-
{%- if node.child_nav_order == 'desc' or node.child_nav_order == 'reversed' -%}
|
43
|
-
{%- assign children_list = children_list | reverse -%}
|
44
|
-
{%- endif -%}
|
45
|
-
<ul class="nav-list">
|
46
|
-
{%- for child in children_list -%}
|
47
|
-
<li class="nav-list-item">
|
48
|
-
{%- if child.has_children -%}
|
49
|
-
<button class="nav-list-expander btn-reset" aria-label="toggle items in {{ child.title }} category" aria-pressed="false">
|
50
|
-
<svg viewBox="0 0 24 24" aria-hidden="true"><use xlink:href="#svg-arrow-right"></use></svg>
|
51
|
-
</button>
|
52
|
-
{%- endif -%}
|
53
|
-
<a href="{{ child.url | relative_url }}" class="nav-list-link">{{ child.title }}</a>
|
54
|
-
{%- if child.has_children -%}
|
55
|
-
{%- assign grand_children_list = third_level_pages
|
56
|
-
| where: "parent", child.title
|
57
|
-
| where: "grand_parent", node.title -%}
|
58
|
-
{%- if child.child_nav_order == 'desc' or child.child_nav_order == 'reversed' -%}
|
59
|
-
{%- assign grand_children_list = grand_children_list | reverse -%}
|
60
|
-
{%- endif -%}
|
61
|
-
<ul class="nav-list">
|
62
|
-
{%- for grand_child in grand_children_list -%}
|
63
|
-
<li class="nav-list-item">
|
64
|
-
<a href="{{ grand_child.url | relative_url }}" class="nav-list-link">{{ grand_child.title }}</a>
|
65
|
-
</li>
|
66
|
-
{%- endfor -%}
|
67
|
-
</ul>
|
68
|
-
{%- endif -%}
|
69
|
-
</li>
|
70
|
-
{%- endfor -%}
|
71
|
-
</ul>
|
72
|
-
{%- endif -%}
|
73
|
-
</li>
|
74
|
-
{%- endfor -%}
|
75
|
-
</ul>
|