-
Notifications
You must be signed in to change notification settings - Fork 356
✨ Using sphinx toc functions #219
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
7b56b8b
fixing single-page header bug
choldgraf 73876b7
adding raw mode to sidebar code
choldgraf 1c640a6
Merge remote-tracking branch 'upstream/master' into missing_sidebar
jorisvandenbossche d55b48a
add back external links
jorisvandenbossche 32d5a94
get show_toc_level working ..
jorisvandenbossche b2086d9
update expected test output
jorisvandenbossche 7080fc0
temp
jorisvandenbossche 69b12a6
Merge remote-tracking branch 'upstream/master' into missing_sidebar
jorisvandenbossche f908b0b
undo temp
jorisvandenbossche 7ad0584
much simpler way to support show_toc_level config
jorisvandenbossche f3a6c41
fix multiple headers in toc
jorisvandenbossche c14ea0e
remove page-header
jorisvandenbossche 7e1cd20
rename to generate_nav/toc_html + keep bs-based version of old ones f…
jorisvandenbossche File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -29,4 +29,3 @@ Other sites that are using this theme: | |
|
|
||
| demo/index | ||
| changelog | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -8,4 +8,4 @@ User Guide | |
|
|
||
| install | ||
| configuring | ||
| customizing | ||
| customizing | ||
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,32 +1,7 @@ | ||
| <nav class="bd-links" id="bd-docs-nav" aria-label="Main navigation"> | ||
|
|
||
| <div class="bd-toc-item active"> | ||
| {% set nav = get_nav_object(maxdepth=3, collapse=True) %} | ||
|
|
||
| <div class="bd-toc-item active"> | ||
| <ul class="nav bd-sidenav"> | ||
| {% for main_nav_item in nav %} | ||
| {% if main_nav_item.active %} | ||
| {% for nav_item in main_nav_item.children %} | ||
| {% if nav_item.children %} | ||
|
|
||
| <li class="{% if nav_item.active%}active{% endif %}"> | ||
| <a href="{{ nav_item.url }}">{{ nav_item.title }}</a> | ||
| <ul> | ||
| {% for nav_item in nav_item.children %} | ||
| <li class="{% if nav_item.active%}active{% endif %}"> | ||
| <a href="{{ nav_item.url }}">{{ nav_item.title }}</a> | ||
| </li> | ||
| {% endfor %} | ||
| </ul> | ||
| </li> | ||
| {% else %} | ||
| <li class="{% if nav_item.active%}active{% endif %}"> | ||
| <a href="{{ nav_item.url }}">{{ nav_item.title }}</a> | ||
| </li> | ||
| {% endif %} | ||
| {% endfor %} | ||
| {% endif %} | ||
| {% endfor %} | ||
| </ul> | ||
|
|
||
| </nav> | ||
| {{ get_nav_object("sidebar", maxdepth=4, collapse=True, includehidden=True, titles_only=True) }} | ||
| </ul> | ||
| </div> | ||
| </nav> |
This file contains hidden or 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 hidden or 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
2 changes: 1 addition & 1 deletion
2
...ndex.4eb26a98c046fa117c2b75e31c15adbb.css → ...ndex.c3e2c6722ba453f25ccfb016116cf7cd.css
Large diffs are not rendered by default.
Oops, something went wrong.
File renamed without changes.
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@choldgraf this is "a" way that I found to get
show_toc_levelworking, but I find it kind of hacky ..The problem with the basic
loop above this loop is that this is a flat iterator, and so you don't know how "deep" you are for each
ul.This "workaround" uses the
toc-hNclass names we added above, to find the appropriate levels ofulfor which to add the class. I didn't directly find a way with beautifulsoup to only search a certain number of levels down.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems reasonable to me :-), but maybe we should add a comment to explain your reasoning here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, not sure why I missed that earlier. But of course the code that adds those
toc-hNclasses (the classes that I was then using here to navigate the soup as a workaround), is already recursively iterating through the lists keeping track of the level ... :)So simplified this