Skip to content

Commit 7a7f14e

Browse files
authored
Merge pull request #8 from jklymak/make-logo-default
ENH: remove the need to specify the icon links
2 parents b10c471 + 8cdc134 commit 7a7f14e

File tree

7 files changed

+68
-59
lines changed

7 files changed

+68
-59
lines changed

docs/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# You can set these variables from the command line, and also
55
# from the environment for the first two.
6-
SPHINXOPTS ?= "-vv"
6+
SPHINXOPTS ?= "-vvv"
77
SPHINXBUILD ?= sphinx-build
88
SOURCEDIR = .
99
BUILDDIR = _build

docs/conf.py

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import datetime
2+
13
# Configuration file for the Sphinx documentation builder for
24
# matplotlib projects.
35

@@ -7,8 +9,10 @@
79
# -- Project information -----------------------------------------------------
810

911
project = "Matplotlib Sphinx Theme"
10-
copyright = "2021, Matplotlib Contributors"
11-
author = "Matplotlib Contributors"
12+
copyright = (
13+
f"2012 - {datetime.datetime.now().year} The Matplotlib development team"
14+
)
15+
author = "Matplotlib Developers"
1216

1317

1418
# -- General configuration ---------------------------------------------------
@@ -28,37 +32,13 @@
2832
# -- Options for HTML output -------------------------------------------------
2933

3034
html_theme = "mpl_sphinx_theme"
31-
html_logo = "_static/logo2.svg"
3235
html_favicon = "_static/favicon.ico"
3336
html_theme_options = {
3437
"logo_link": "https://matplotlib.org/stable/",
3538
# collapse_navigation in pydata-sphinx-theme is slow, so skipped for local
3639
# and CI builds https://github.com/pydata/pydata-sphinx-theme/pull/386
3740
"collapse_navigation": not is_release_build,
38-
"icon_links": [
39-
{
40-
"name": "gitter",
41-
"url": "https://gitter.im/matplotlib",
42-
"icon": "fab fa-gitter",
43-
},
44-
{
45-
"name": "discourse",
46-
"url": "https://discourse.matplotlib.org",
47-
"icon": "fab fa-discourse",
48-
},
49-
{
50-
"name": "GitHub",
51-
"url": "https://github.com/matplotlib/matplotlib",
52-
"icon": "fab fa-github-square",
53-
},
54-
{
55-
"name": "twitter",
56-
"url": "https://twitter.com/matplotlib/",
57-
"icon": "fab fa-twitter-square",
58-
},
59-
],
6041
"show_prev_next": False,
61-
"navbar_center": ["mpl_nav_bar.html"],
6242
"native_site": False
6343
}
6444

docs/index.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ line in your conf.py file
1919
And by including ``mpl_sphinx_theme`` as a requirement in your documentation
2020
installation.
2121

22-
Note that the theme does not currently install the `logo2.svg` or
23-
the `favicon.ico`. You shoudl copy those from `docs/_static` to
24-
the local project `docs/_static`.
22+
Note that the option ``html_logo`` need not be specified as it is for
23+
``pydata-sphinx-theme``.
24+
25+
To change the top navbar, edit ``mpl_sphinx_theme/mpl_nav_bar.html``
2526

2627
The full ``conf.py`` is
2728

mpl_sphinx_theme/mpl_icon_links.html

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{%- block icon_links -%}
2+
{%- macro icon_link_nav_item(url, icon, name) -%}
3+
{%- if url | length > 2 %}
4+
<li class="nav-item">
5+
<a class="nav-link" href="{{ url }}" rel="noopener" target="_blank" title="{{ _(name) }}">
6+
<span><i class="{{ icon }}"></i></span>
7+
<label class="sr-only">{{ _(name) }}</label>
8+
</a>
9+
</li>
10+
{%- endif -%}
11+
{%- endmacro -%}
12+
{%- if theme_icon_links %}
13+
<ul id="navbar-icon-links" class="navbar-nav" aria-label="{{ _(theme_icon_links_label) }}">
14+
{%- block icon_link_shortcuts -%}
15+
{{ icon_link_nav_item(theme_github_url, "fab fa-github-square", "GitHub") -}}
16+
{{ icon_link_nav_item(theme_gitlab_url, "fab fa-gitlab", "GitLab") -}}
17+
{{ icon_link_nav_item(theme_bitbucket_url, "fab fa-bitbucket", "Bitbucket") -}}
18+
{{ icon_link_nav_item(theme_twitter_url, "fab fa-twitter-square", "Twitter") -}}
19+
{% endblock -%}
20+
{%- for icon_link in theme_icon_links -%}
21+
{{ icon_link_nav_item(icon_link["url"], icon_link["icon"], icon_link["name"]) -}}
22+
{%- endfor %}
23+
</ul>
24+
{%- else %}
25+
<ul id="navbar-icon-links" class="navbar-nav" aria-label="{{ _(theme_icon_links_label) }}">
26+
<li class="nav-item">
27+
<a class="nav-link" href="https://gitter.im/matplotlib" rel="noopener" target="_blank" title="gitter">
28+
<span><i class="fab fa-gitter"></i></span>
29+
<label class="sr-only">gitter</label>
30+
</a>
31+
</li>
32+
<li class="nav-item">
33+
<a class="nav-link" href="https://discourse.matplotlib.org" rel="noopener" target="_blank" title="discourse">
34+
<span><i class="fab fa-discourse"></i></span>
35+
<label class="sr-only">discourse</label>
36+
</a>
37+
</li>
38+
<li class="nav-item">
39+
<a class="nav-link" href="https://github.com/matplotlib/matplotlib" rel="noopener" target="_blank" title="GitHub">
40+
<span><i class="fab fa-github-square"></i></span>
41+
<label class="sr-only">GitHub</label>
42+
</a>
43+
</li>
44+
<li class="nav-item">
45+
<a class="nav-link" href="https://twitter.com/matplotlib/" rel="noopener" target="_blank" title="twitter">
46+
<span><i class="fab fa-twitter-square"></i></span>
47+
<label class="sr-only">twitter</label>
48+
</a>
49+
</li>
50+
</ul>
51+
{%- endif %}
52+
{%- endblock %}
-12.3 KB
Binary file not shown.

mpl_sphinx_theme/static/images/dask-horizontal-white.svg

Lines changed: 0 additions & 28 deletions
This file was deleted.

mpl_sphinx_theme/theme.conf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,8 @@ inherit = pydata_sphinx_theme
33
stylesheet = css/style.css
44

55
[options]
6-
native_site = False
6+
native_site = False
7+
navbar_start = mpl_navbar_logo.html
8+
navbar_center = mpl_nav_bar.html
9+
navbar_end = mpl_icon_links.html
10+
logo_link =

0 commit comments

Comments
 (0)