Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitdf5d59a

Browse files
committed
DOC: Restore banner indicating docs are unreleased
This was dropped when switching to the pydata-sphinx-theme. They have amethod of adding an announcement, but because it's a pure textsubstitution, we can't have it automatically search like our old banner.While the theme also supports loading from an http resource, that wouldmean writing some JavaScript instead of automatically creating this divat build time.So override the theme component, and create the search link at buildtime.
1 parentabb2059 commitdf5d59a

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: solidvar(--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-announcementa {
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
.contentsul {
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+
<divclass="{{ header_classes | join(' ') }}"id="unreleased-message">
4+
<divclass="bd-header-announcement__content">
5+
You are reading documentation for the unreleased version of Matplotlib.
6+
<ahref="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"ifnotis_release_buildelse"",
466470
}
467471
include_analytics=is_release_build
468472
ifinclude_analytics:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp