forked from just-the-docs/just-the-docs
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow unlimited multi-level navigation
This PR is intended to supersede just-the-docs#462. The only user-level difference from just-the-docs#462 is that disambiguation of parent pages has to use either `grand_parent` or `ancestor` titles: the somewhat unnatural `section_id` and `in_section` fields are not supported. The implementation has been significantly simplified by the changes introduced in v0.7.0 of the theme. This initial draft has not yet been rigorously tested nor profiled.
- Loading branch information
Showing
41 changed files
with
324 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{%- comment -%} | ||
Include as: {%- include components/nav/children.html node=node ancestors=title_array -%} | ||
Depends on: include.node, include.ancestors. | ||
Assigns to: nav_children. | ||
Overwrites: | ||
nav_candidates, nav_child, nav_child_ok. | ||
{%- endcomment -%} | ||
|
||
{%- assign nav_candidates = nav_parenthood | ||
| where: "name", include.node.title | map: "items" | first -%} | ||
{%- assign nav_children = "" | split: "" -%} | ||
|
||
{%- for nav_child in nav_candidates -%} | ||
{%- assign nav_child_ok = true -%} | ||
|
||
{%- if nav_child.grand_parent and nav_child.grand_parent != include.node.parent -%} | ||
{%- assign nav_child_ok = false -%} | ||
{%- endif -%} | ||
|
||
{%- if nav_child.ancestor and nav_child.ancestor != include.node.title -%} | ||
{%- unless include.ancestors contains nav_child.ancestor -%} | ||
{%- assign nav_child_ok = false -%} | ||
{%- endunless -%} | ||
{%- endif -%} | ||
|
||
{%- if nav_child_ok -%} | ||
{%- assign nav_children = nav_children | push: nav_child -%} | ||
{%- endif -%} | ||
{%- endfor -%} |
Oops, something went wrong.