File tree 3 files changed +30
-8
lines changed
3 files changed +30
-8
lines changed Original file line number Diff line number Diff line change 17
17
# Sphinx monkeypatch for adding toctree objects into context
18
18
19
19
20
- def convert_docutils_node (list_item ):
20
+ def convert_docutils_node (list_item , only_pages = False ):
21
21
if not list_item .children :
22
22
return None
23
23
reference = list_item .children [0 ].children [0 ]
24
24
title = reference .astext ()
25
25
url = reference .attributes ["refuri" ]
26
26
active = "current" in list_item .attributes ["classes" ]
27
27
28
+ if only_pages and '#' in url :
29
+ return None
30
+
28
31
nav = {}
29
32
nav ["title" ] = title
30
33
nav ["url" ] = url
@@ -33,7 +36,7 @@ def convert_docutils_node(list_item):
33
36
34
37
if len (list_item .children ) > 1 :
35
38
for child_item in list_item .children [1 ].children :
36
- child_nav = convert_docutils_node (child_item )
39
+ child_nav = convert_docutils_node (child_item , only_pages = only_pages )
37
40
if child_nav is not None :
38
41
nav ["children" ].append (child_nav )
39
42
@@ -50,7 +53,7 @@ def get_nav_object(**kwds):
50
53
51
54
nav = []
52
55
for child in toctree .children [0 ].children :
53
- child_nav = convert_docutils_node (child )
56
+ child_nav = convert_docutils_node (child , only_pages = True )
54
57
nav .append (child_nav )
55
58
56
59
return nav
Original file line number Diff line number Diff line change 7
7
< nav class ="bd-links " id ="bd-docs-nav " aria-label ="Main navigation ">
8
8
9
9
< div class ="bd-toc-item active ">
10
- {% set nav = get_nav_object(maxdepth=2 ) %}
10
+ {% set nav = get_nav_object(maxdepth=3 ) %}
11
11
12
12
< ul class ="nav bd-sidenav ">
13
13
{% for main_nav_item in nav %}
14
14
{% if main_nav_item.active %}
15
15
{% for nav_item in main_nav_item.children %}
16
16
{% if nav_item.children %}
17
17
18
- < li > {{ nav_item.title }}
18
+ < li class ="{% if nav_item.active%}active{% endif %} ">
19
+ < a href ="{{ nav_item.url }} "> {{ nav_item.title }}</ a >
19
20
< ul >
20
21
{% for nav_item in nav_item.children %}
21
- < li class ="{% if nav_item.active%}active bd-sidenav-active {% endif %} ">
22
+ < li class ="{% if nav_item.active%}active{% endif %} ">
22
23
< a href ="{{ nav_item.url }} "> {{ nav_item.title }}</ a >
23
24
</ li >
24
25
{% endfor %}
Original file line number Diff line number Diff line change 159
159
.bd-toc-item .active > .bd-sidenav {
160
160
display : block;
161
161
}
162
-
162
+
163
163
.bd-sidebar .nav > li > a {
164
164
display : block;
165
165
padding : .25rem 1.5rem ;
183
183
background-color: transparent; */
184
184
}
185
185
186
-
186
+ .bd-sidebar .nav > li > ul {
187
+ list-style : none;
188
+ padding : .25rem 1.5rem ;
189
+ }
190
+
191
+ .bd-sidebar .nav > li > ul > li > a {
192
+ display : block;
193
+ padding : .25rem 1.5rem ;
194
+ font-size : 90% ;
195
+ color : rgba (0 , 0 , 0 , 0.65 );
196
+ }
197
+
198
+ .bd-sidebar .nav > li > ul > .active > a ,
199
+ .bd-sidebar .nav > li > ul > .active : hover > a {
200
+ font-weight : 600 ;
201
+ background : # 007bff ;
202
+ color : white;
203
+ }
204
+
187
205
/* offsetting html anchor titles to adjust for fixed header, https://github.com/pandas-dev/pandas-sphinx-theme/issues/6*/
188
206
h2 ::before , h3 ::before ,
189
207
h4 ::before , h5 ::before ,
You can’t perform that action at this time.
0 commit comments