8000 Move version info to sidebar by timhoffm · Pull Request #16255 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Move version info to sidebar #16255

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions doc/_static/mpl.css
Original file line number Diff line number Diff line change
Expand Up @@ -1133,15 +1133,16 @@ div.viewcode-block:target {

}

.sidebar-announcement {
.sidebar-announcement,
.sidebar-versions {
border: 1px solid #11557C;
background: #eff9ff;
padding: 2px;
padding: 0.2em 0.5em;
margin-top: 1em;
}

.sidebar-announcement p {
margin: 0.4em 0.4em 0.6em 0.4em;
margin: 0.4em 0 0.6em 0;
}

/* new main nav */
Expand Down
38 changes: 38 additions & 0 deletions doc/_templates/sidebar_versions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<div class="sidebar-versions">
<script>
function getSnippet(id, url) {
var req = false;
// For Safari, Firefox, and other non-MS browsers
if (window.XMLHttpRequest) {
try {
req = new XMLHttpRequest();
} catch (e) {
req = false;
}
} else if (window.ActiveXObject) {
// For Internet Explorer on Windows
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
req = false;
}
}
}
var element = document.querySelector(".sidebar-versions");
if (req) {
// Synchronous request, wait till we have it all
req.open('GET', url, false);
req.send(null);
if (req.status == 200) {
element.innerHTML = req.responseText;
} else {
element.innerHTML = "<mark>Could not find Snippet to insert at " + url + "</mark>"
}
}
}
getSnippet('other_versions', '/versions.html');
</script>
</div>
3 changes: 2 additions & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ def _check_dependencies():

# Custom sidebar templates, maps page names to templates.
html_sidebars = {
'index': ['sidebar_announcement.html', 'donate_sidebar.html'],
'index': ['sidebar_announcement.html', 'sidebar_versions.html',
'donate_sidebar.html'],
'**': ['localtoc.html', 'relations.html', 'pagesource.html']
}

Expand Down
43 changes: 0 additions & 43 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,51 +49,8 @@ oriented interface or via a set of functions familiar to MATLAB users.
Documentation
-------------

This is the documentation for Matplotlib version |version|.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The section does not cover versions anymore. It's ok to remove this because we already have it more prominently in the title.
grafik


To get started, read the :doc:`User's Guide <users/index>`.

.. raw:: html

<p id="other_versions"></p>

<script>
function getSnippet(id, url) {
var req = false;
// For Safari, Firefox, and other non-MS browsers
if (window.XMLHttpRequest) {
try {
req = new XMLHttpRequest();
} catch (e) {
req = false;
}
} else if (window.ActiveXObject) {
// For Internet Explorer on Windows
try {
req = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
req = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
req = false;
}
}
}
var element = document.getElementById(id);
if (req) {
// Synchronous request, wait till we have it all
req.open('GET', url, false);
req.send(null);
if (req.status == 200) {
element.innerHTML = req.responseText;
} else {
element.innerHTML = "<mark>Could not find Snippet to insert at " + url + "</mark>"
}
}
}
getSnippet('other_versions', '/versions.html');
</script>

Trying to learn how to do a particular kind of plot? Check out the
:doc:`examples gallery <gallery/index>` or the :doc:`list of plotting commands
<api/pyplot_summary>`.
Expand Down
0