Skip to content

Commit 669f7b0

Browse files
Update sphinx theme (networkx#6930)
* Update sphinx theme * Get rid of custom dev banner * Remove duplicate search box * Use theme's version switcher * Fix docstrings * Fix theme * Remove old file * Update release process
1 parent e370e5a commit 669f7b0

File tree

12 files changed

+22
-109
lines changed

12 files changed

+22
-109
lines changed

doc/_static/custom.css

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,3 @@
1-
.version-stable {
2-
background-color: #2c7fb8ff;
3-
color: #2c7fb8ff;
4-
}
5-
6-
.version-alert a {
7-
text-decoration: underline;
8-
background-color: #2c7fb8ff;
9-
color: #ddd;
10-
}
11-
12-
.version-alert {
13-
background-color: #ff7f0eff;
14-
cff7f0effolor: #fff;
15-
font-family: "Work Sans", sans-serif;
16-
font-weight: 600; font-size: 16px;
17-
}
18-
19-
.btn-version {
20-
background: #2c7fb8ff;
21-
color: #ffffff;
22-
}
23-
24-
.btn-version:hover, .btn-version:focus, .btn-version:active, .btn-version.active, .open > .dropdown-toggle.btn-version {
25-
background: #33a6cc;
26-
}
27-
28-
.btn-version:active, .btn-version.active {
29-
background: #007299;
30-
box-shadow: none;
31-
}
32-
331
.team-member {
342
display: inline-block;
353
padding: 1rem;

doc/_templates/dev_banner.html

Lines changed: 0 additions & 13 deletions
This file was deleted.

doc/_templates/eol_banner.html

Lines changed: 0 additions & 11 deletions
This file was deleted.

doc/_templates/layout.html

Lines changed: 0 additions & 2 deletions
This file was deleted.

doc/_templates/version.html

Lines changed: 0 additions & 22 deletions
This file was deleted.

doc/conf.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,16 @@
140140
},
141141
],
142142
"external_links": [{"name": "Guides", "url": "https://networkx.org/nx-guides/"}],
143-
"navbar_end": ["theme-switcher", "navbar-icon-links", "version"],
144-
"secondary_sidebar_items": ["search-field", "page-toc", "edit-this-page"],
143+
"navbar_end": ["theme-switcher", "navbar-icon-links", "version-switcher"],
144+
"secondary_sidebar_items": ["page-toc", "edit-this-page"],
145145
"header_links_before_dropdown": 7,
146+
"switcher": {
147+
"json_url": (
148+
"https://networkx.org/documentation/latest/_static/version_switcher.json"
149+
),
150+
"version_match": "latest" if "dev" in version else version,
151+
},
152+
"show_version_warning_banner": True,
146153
}
147154
html_sidebars = {
148155
"**": ["sidebar-nav-bs", "sidebar-ethical-ads"],
@@ -189,14 +196,6 @@
189196
# Output file base name for HTML help builder.
190197
htmlhelp_basename = "NetworkX"
191198

192-
html_context = {
193-
"versions_dropdown": {
194-
"latest": "devel (latest)",
195-
"stable": "current (stable)",
196-
},
197-
"default_mode": "light",
198-
}
199-
200199
# Options for LaTeX output
201200
# ------------------------
202201

doc/developer/release.rst

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ Release Process
2222

2323
7. Add ``release_<major>.<minor>`` to ``doc/release/index.rst``.
2424

25-
- Delete developer banner on docs::
26-
27-
git rm doc/_templates/layout.html
25+
- Edit ``doc/_static/version_switcher.json`` in order to add the release, move the
26+
key value pair `"preferred": true` to the most recent stable version, and commit.
2827

2928
- Update ``__version__`` in ``networkx/__init__.py``.
3029

@@ -87,14 +86,9 @@ Release Process
8786

8887
- Update ``__version__`` in ``networkx/__init__.py``.
8988

90-
- Create ``doc/_templates/layout.html`` with::
91-
92-
{% extends "!layout.html" %} {% block content %} {% include "dev_banner.html" %}
93-
{{ super() }} {% endblock %}
94-
9589
- Commit and push changes::
9690

97-
git add networkx/__init__.py doc/_templates/layout.html
91+
git add networkx/__init__.py
9892
git commit -m "Bump release version"
9993
git push origin main
10094

networkx/algorithms/distance_measures.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ def resistance_distance(G, nodeA=None, nodeB=None, weight=None, invert_weight=Tr
688688
dictionary of nodes with resistance distances as the value.
689689
690690
Raises
691-
-------
691+
------
692692
NetworkXNotImplemented
693693
If `G` is a directed graph.
694694

networkx/algorithms/operators/all.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ def disjoint_union_all(graphs):
135135
NetworkXError
136136
In case of mixed type graphs, like MultiGraph and Graph, or directed and undirected graphs.
137137
138-
Example
139-
-------
138+
Examples
139+
--------
140140
>>> G1 = nx.Graph([(1, 2), (2, 3)])
141141
>>> G2 = nx.Graph([(4, 5), (5, 6)])
142142
>>> U = nx.disjoint_union_all([G1, G2])
@@ -189,8 +189,8 @@ def compose_all(graphs):
189189
NetworkXError
190190
In case of mixed type graphs, like MultiGraph and Graph, or directed and undirected graphs.
191191
192-
Example
193-
-------
192+
Examples
193+
--------
194194
>>> G1 = nx.Graph([(1, 2), (2, 3)])
195195
>>> G2 = nx.Graph([(3, 4), (5, 6)])
196196
>>> C = nx.compose_all([G1, G2])
@@ -276,8 +276,8 @@ def intersection_all(graphs):
276276
>>> gh.nodes(data=True)
277277
NodeDataView({0: {'new_capacity': 2}, 1: {'new_capacity': 3}})
278278
279-
Example
280-
-------
279+
Examples
280+
--------
281281
>>> G1 = nx.Graph([(1, 2), (2, 3)])
282282
>>> G2 = nx.Graph([(2, 3), (3, 4)])
283283
>>> R = nx.intersection_all([G1, G2])

networkx/algorithms/smetric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ def s_metric(G, **kwargs):
1515
G : graph
1616
The graph used to compute the s-metric.
1717
normalized : bool (optional)
18+
Normalize the value.
1819
1920
.. deprecated:: 3.2
2021
2122
The `normalized` keyword argument is deprecated and will be removed
2223
in the future
23-
Normalize the value.
2424
2525
Returns
2626
-------

0 commit comments

Comments
 (0)