8000 Merge pull request #16255 from timhoffm/sidebar-versions · matplotlib/matplotlib@5cb84e0 · GitHub
[go: up one dir, main page]

Skip to content
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 5cb84e0

Browse files
authored
Merge pull request #16255 from timhoffm/sidebar-versions
Move version info to sidebar
2 parents 1ad7eb0 + cfb59d6 commit 5cb84e0

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
}
< 10000 /td>
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 {
3 10000 2+
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
@@ -259,7 +259,8 @@ def _check_dependencies():
259259

260260
# Custom sidebar templates, maps page names to templates.
261261
html_sidebars = {
262-
'index': ['sidebar_announcement.html', 'donate_sidebar.html'],
262+
'index': ['sidebar_announcement.html', 'sidebar_versions.html',
263+
'donate_sidebar.html'],
263264
'**': ['localtoc.html', 'relations.html', 'pagesource.html']
264265
}
265266

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