Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c0d9c98

Browse files
authored
Merge pull request #26219 from QuLogic/restore-unreleased-banner
DOC: Restore banner indicating docs are unreleased
2 parents f99b6ee + df5d59a commit c0d9c98

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

doc/_static/mpl.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,29 @@
99
margin: 0;
1010
}
1111

12+
/* Make announcement an error colour for unreleased documentation, and sticky. */
13+
#unreleased-message.bd-header-announcement {
14+
border-bottom: solid var(--pst-color-danger-highlight);
15+
color: var(--pst-color-danger-text);
16+
font-weight: var(--pst-admonition-font-weight-heading);
17+
position: sticky;
18+
top: 0;
19+
z-index: 1050;
20+
}
21+
22+
#unreleased-message.bd-header-announcement:after {
23+
background-color: var(--pst-color-danger);
24+
opacity: 1;
25+
}
26+
27+
#unreleased-message.bd-header-announcement a {
28+
color: var(--pst-color-danger-text);
29+
}
30+
31+
#unreleased-message.bd-header-announcement + .bd-navbar {
32+
top: 3rem; /* Minimum height of announcement header. */
33+
}
34+
1235
/* multi column TOC */
1336
.contents ul {
1437
list-style-type: none;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{%- if theme_announcement == "unreleased" -%}
2+
{% set header_classes = ["bd-header-announcement", "container-fluid"] %}
3+
<div class="{{ header_classes | join(' ') }}" id="unreleased-message">
4+
<div class="bd-header-announcement__content">
5+
You are reading documentation for the unreleased version of Matplotlib.
6+
<a href="https://matplotlib.org/search.html?q={{ title | striptags | urlencode }}&amp;check_keywords=yes&amp;area=default">
7+
Try searching for the released version of this page instead?
8+
</a>
9+
</div>
10+
</div>
11+
{%- else -%}
12+
{%- extends "!sections/announcement.html" -%}
13+
{%- endif %}

doc/conf.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,11 @@ def js_tag_with_cache_busting(js):
462462
},
463463
"navbar_end": ["theme-switcher", "version-switcher", "mpl_icon_links"],
464464
"secondary_sidebar_items": "page-toc.html",
465-
"footer_start": ["copyright", "sphinx-version", "doc_version"],
465+
"footer_start": ["copyright", "sphinx-version", "doc_version"],
466+
# We override the announcement template from pydata-sphinx-theme, where
467+
# this special value indicates the use of the unreleased banner. If we need
468+
# an actual announcement, then just place the text here as usual.
469+
"announcement": "unreleased" if not is_release_build else "",
466470
}
467471
include_analytics = is_release_build
468472
if include_analytics:

0 commit comments

Comments
 (0)