Skip to content

Commit c10eddd

Browse files
authored
Fix sphinx-bootstrap-theme styling (#167)
The introduction of the page hierarchies broke the bootstrap tree for any project that does not use `page`. Solution is to only select / apply the `treeview` functions if the id anchors are found.
1 parent cd251a9 commit c10eddd

File tree

3 files changed

+75
-46
lines changed

3 files changed

+75
-46
lines changed

docs/changelog.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ Changelog
55
:local:
66
:backlinks: none
77

8+
v0.3.3
9+
----------------------------------------------------------------------------------------
10+
11+
- Fix sphinx-bootstrap-theme styling, the introduction of the page hierarchies broke
12+
the bootstrap tree for any project that does not use ``page``. Solution is to only
13+
select / apply the ``treeview`` functions if the id anchors are found (:pr:`167`).
14+
815
v0.3.2
916
----------------------------------------------------------------------------------------
1017

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,26 @@
11
$(document).ready(function() {
2-
// apply the class view hierarchy
3-
$("#class-treeView").treeview({
4-
data: getClassViewTree(),
5-
enableLinks: true
6-
});
7-
8-
// apply the directory view hierarchy
9-
$("#directory-treeView").treeview({
10-
data: getDirectoryViewTree(),
11-
enableLinks: true
12-
});
2+
// apply the page view hierarchy if it exists
3+
var page_view = $("#page-treeView");
4+
if (page_view.length) {
5+
page_view.treeview({
6+
data: getPageHierarchyTree(),
7+
enableLinks: true
8+
});
9+
}
10+
// apply the class view hierarchy if it exists
11+
var class_view = $("#class-treeView");
12+
if (class_view.length) {
13+
class_view.treeview({
14+
data: getClassViewTree(),
15+
enableLinks: true
16+
});
17+
}
18+
// apply the directory view hierarchy if it exists
19+
var dir_view = $("#directory-treeView");
20+
if (dir_view.length) {
21+
dir_view.treeview({
22+
data: getDirectoryViewTree(),
23+
enableLinks: true
24+
});
25+
}
1326
});

exhale/graph.py

Lines changed: 44 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3654,41 +3654,50 @@ def generateAPIRootBody(self):
36543654
*/
36553655
// Part 1: use linkColor as a parameter to bootstrap treeview
36563656
3657-
// apply the page view hierarchy
3658-
$("#{page_idx}").treeview({{
3659-
data: {page_func_name}(),
3660-
enableLinks: true,
3661-
color: linkColor,
3662-
showTags: {show_tags},
3663-
collapseIcon: "{collapse_icon}",
3664-
expandIcon: "{expand_icon}",
3665-
levels: {levels},
3666-
onhoverColor: "{onhover_color}"
3667-
}});
3668-
3669-
// apply the class view hierarchy
3670-
$("#{class_idx}").treeview({{
3671-
data: {class_func_name}(),
3672-
enableLinks: true,
3673-
color: linkColor,
3674-
showTags: {show_tags},
3675-
collapseIcon: "{collapse_icon}",
3676-
expandIcon: "{expand_icon}",
3677-
levels: {levels},
3678-
onhoverColor: "{onhover_color}"
3679-
}});
3680-
3681-
// apply the file view hierarchy
3682-
$("#{file_idx}").treeview({{
3683-
data: {file_func_name}(),
3684-
enableLinks: true,
3685-
color: linkColor,
3686-
showTags: {show_tags},
3687-
collapseIcon: "{collapse_icon}",
3688-
expandIcon: "{expand_icon}",
3689-
levels: {levels},
3690-
onhoverColor: "{onhover_color}"
3691-
}});
3657+
// apply the page view hierarchy if it exists
3658+
var page_h = $("#{page_idx}");
3659+
if (page_h.length) {{
3660+
page_h.treeview({{
3661+
data: {page_func_name}(),
3662+
enableLinks: true,
3663+
color: linkColor,
3664+
showTags: {show_tags},
3665+
collapseIcon: "{collapse_icon}",
3666+
expandIcon: "{expand_icon}",
3667+
levels: {levels},
3668+
onhoverColor: "{onhover_color}"
3669+
}});
3670+
}}
3671+
3672+
// apply the class view hierarchy if it exists
3673+
var class_h = $("#{class_idx}");
3674+
if (class_h.length) {{
3675+
class_h.treeview({{
3676+
data: {class_func_name}(),
3677+
enableLinks: true,
3678+
color: linkColor,
3679+
showTags: {show_tags},
3680+
collapseIcon: "{collapse_icon}",
3681+
expandIcon: "{expand_icon}",
3682+
levels: {levels},
3683+
onhoverColor: "{onhover_color}"
3684+
}});
3685+
}}
3686+
3687+
// apply the file view hierarchy if it exists
3688+
var file_h = $("#{file_idx}");
3689+
if (file_h.length) {{
3690+
file_h.treeview({{
3691+
data: {file_func_name}(),
3692+
enableLinks: true,
3693+
color: linkColor,
3694+
showTags: {show_tags},
3695+
collapseIcon: "{collapse_icon}",
3696+
expandIcon: "{expand_icon}",
3697+
levels: {levels},
3698+
onhoverColor: "{onhover_color}"
3699+
}});
3700+
}}
36923701
36933702
// Part 2: override the style of the glyphicons by injecting some CSS
36943703
$('<style type="text/css" id="exhaleTreeviewOverride">' +

0 commit comments

Comments
 (0)