8000 Merge pull request #16352 from timhoffm/auto-backport-of-pr-16255-on-… · matplotlib/matplotlib@0c8db46 · GitHub
[go: up one dir, main page]

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0c8db46

Browse files
authored
Merge pull request #16352 from timhoffm/auto-backport-of-pr-16255-on-v2.2.x
Backport PR #16255 on branch v2.2.x (Move version info to sidebar)
2 parents 80386a0 + 7ec1740 commit 0c8db46

File tree

4 files changed

+51
-47
lines changed

4 files changed

+51
-47
lines changed

doc/_static/mpl.css

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,15 +1006,24 @@ div.viewcode-block:target {
10061006

10071007
}
10081008

1009-
.sidebar-announcement {
1009+
.sidebar-announcement,
1010+
.sidebar-versions {
10101011
border: 1px solid #11557C;
10111012
background: #eff9ff;
1012-
padding: 2px;
1013+
padding: 0.2em 0.5em;
1014+
margin-top: 1em;
1015+
}
1016+
1017+
.sidebar-announcement {
10131018
margin-top: 40px;
10141019
}
10151020

1021+
.sidebar-versions {
1022+
margin-top: 1em;
1023+
}
1024+
10161025
.sidebar-announcement p {
1017-
margin: 0.4em 0.4em 0.6em 0.4em;
1026+
margin: 0.4em 0 0.6em 0;
10181027
}
10191028

10201029
/* new main nav */

doc/_templates/sidebar_versions.html

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<div class="sidebar-versions">
2+
<script>
3+
function getSnippet(id, url) {
4+
var req = false;
5+
// For Safari, Firefox, and other non-MS browsers
6+
if (window.XMLHttpRequest) {
7+
try {
8+
req = new XMLHttpRequest();
9+
} catch (e) {
10+
req = false;
11+
}
12+
} else if (window.ActiveXObject) {
13+
// For Internet Explorer on Windows
14+
try {
15+
req = new ActiveXObject("Msxml2.XMLHTTP");
16+
} catch (e) {
17+
try {
18+
req = new ActiveXObject("Microsoft.XMLHTTP");
19+
} catch (e) {
20+
req = false;
21+
}
22+
}
23+
}
24+
var element = document.querySelector(".sidebar-versions");
25+
if (req) {
26+
// Synchronous request, wait till we have it all
27+
req.open('GET', url, false);
28+
req.send(null);
29+
if (req.status == 200) {
30+
element.innerHTML = req.responseText;
31+
} else {
32+
element.innerHTML = "<mark>Could not find Snippet to insert at " + url + "</mark>"
33+
}
34+
}
35+
}
36+
getSnippet('other_versions', '/versions.html');
37+
</script>
38+
</div>

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def _check_deps():
263263

264264
# Custom sidebar templates, maps page names to templates.
265265
html_sidebars = {
266-
'index': ['searchbox.html', 'sidebar_announcement.html',
266+
'index': ['searchbox.html', 'sidebar_announcement.html', 'sidebar_versions.html',
267267
'donate_sidebar.html'],
268268
'**': ['searchbox.html', 'localtoc.html', 'relations.html',
269269
'pagesource.html']

doc/index.rst

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -54,51 +54,8 @@ Visit the :doc:`Matplotlib installation instructions <users/installing>`.
5454
Documentation
5555
-------------
5656

57-
This is the documentation for Matplotlib version |version|.
58-
5957
To get started, read the :doc:`User's Guide <users/index>`.
6058

61-
.. raw:: html
62-
63-
<p id="other_versions"></p>
64-
65-
<script>
66-
function getSnippet(id, url) {
67-
var req = false;
68-
// For Safari, Firefox, and other non-MS browsers
69-
if (window.XMLHttpRequest) {
70-
try {
71-
req = new XMLHttpRequest();
72-
} catch (e) {
73-
req = false;
74-
}
75-
} else if (window.ActiveXObject) {
76-
// For Internet Explorer on Windows
77-
try {
78-
req = new ActiveXObject("Msxml2.XMLHTTP");
79-
} catch (e) {
80-
try {
81-
req = new ActiveXObject("Microsoft.XMLHTTP");
82-
} catch (e) {
83-
req = false;
84-
}
85-
}
86-
}
87-
var element = document.getElementById(id);
88-
if (req) {
89-
// Synchronous request, wait till we have it all
90-
req.open('GET', url, false);
91-
req.send(null);
92-
if (req.status == 200) {
93-
element.innerHTML = req.responseText;
94-
} else {
95-
element.innerHTML = "<mark>Could not find Snippet to insert at " + url + "</mark>"
96-
}
97-
}
98-
}
99-
getSnippet('other_versions', '/versions.html');
100-
</script>
101-
10259
Trying to learn how to do a particular kind of plot? Check out the
10360
:doc:`examples gallery <gallery/index>` or the :doc:`list of plotting commands
10461
<api/pyplot_summary>`.

0 commit comments

Comments
 (0)
0