8000 Merge pull request #16348 from meeseeksmachine/auto-backport-of-pr-16… · matplotlib/matplotlib@f98a87e · GitHub
[go: up one dir, main page]

Skip to content

Commit f98a87e

Browse files
authored
Merge pull request #16348 from meeseeksmachine/auto-backport-of-pr-16255-on-v3.1.x
Backport PR #16255 on branch v3.1.x (Move version info to sidebar)
2 parents 99dd33f + 85d8d05 commit f98a87e

File tree

4 files changed

+44
-47
lines changed

4 files changed

+44
-47
lines changed

doc/_static/mpl.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,15 +1133,16 @@ div.viewcode-block:target {
11331133

11341134
}
11351135

1136-
.sidebar-announcement {
1136+
.sidebar-announcement,
1137+
.sidebar-versions {
11371138
border: 1px solid #11557C;
11381139
background: #eff9ff;
1139-
padding: 2px;
1140+
padding: 0.2em 0.5em;
11401141
margin-top: 1em;
11411142
}
11421143

11431144
.sidebar-announcement p {
1144-
margin: 0.4em 0.4em 0.6em 0.4em;
1145+
margin: 0.4em 0 0.6em 0;
11451146
}
11461147

11471148
/* 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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ def _check_dependencies():
249249

250250
# Custom sidebar templates, maps page names to templates.
251251
html_sidebars = {
252-
'index': ['sidebar_announcement.html', 'donate_sidebar.html'],
252+
'index': ['sidebar_announcement.html', 'sidebar_versions.html',
253+
'donate_sidebar.html'],
253254
'**': ['localtoc.html', 'relations.html', 'pagesource.html']
254255
}
255256

doc/index.rst

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -49,51 +49,8 @@ oriented interface or via a set of functions familiar to MATLAB users.
4949
Documentation
5050
-------------
5151

52-
This is the documentation for Matplotlib version |version|.
53-
5452
To get started, read the :doc:`User's Guide <users/index>`.
5553

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

0 commit comments

Comments
 (0)
0