Skip to content

Commit 9700c6d

Browse files
committed
Update sphinx_rtd_theme from version 0.2.4 to version 0.4.3
1 parent 5da55b4 commit 9700c6d

14 files changed

Lines changed: 2790 additions & 6969 deletions

user_guide_src/source/_themes/sphinx_rtd_theme/__init__.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,18 @@
33
From https://github.com/ryan-roemer/sphinx-bootstrap-theme.
44
55
"""
6-
import os
6+
from os import path
77

8-
__version__ = '0.2.4'
8+
__version__ = '0.4.3'
99
__version_full__ = __version__
1010

1111

1212
def get_html_theme_path():
1313
"""Return list of HTML theme paths."""
14-
cur_dir = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
14+
cur_dir = path.abspath(path.dirname(path.dirname(__file__)))
1515
return cur_dir
16+
17+
18+
# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package
19+
def setup(app):
20+
app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__)))

user_guide_src/source/_themes/sphinx_rtd_theme/breadcrumbs.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,27 @@
3636
{% endblock %}
3737
{% block breadcrumbs_aside %}
3838
<li class="wy-breadcrumbs-aside">
39-
{% if pagename != "search" %}
39+
{% if hasdoc(pagename) %}
4040
{% if display_github %}
4141
{% if check_meta and 'github_url' in meta %}
4242
<!-- User defined GitHub URL -->
4343
<a href="{{ meta['github_url'] }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
4444
{% else %}
45-
<a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/blob/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
45+
<a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode|default("blob") }}/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
4646
{% endif %}
4747
{% elif display_bitbucket %}
4848
{% if check_meta and 'bitbucket_url' in meta %}
4949
<!-- User defined Bitbucket URL -->
5050
<a href="{{ meta['bitbucket_url'] }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
5151
{% else %}
52-
<a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
52+
<a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ suffix }}?mode={{ theme_vcs_pageview_mode|default("view") }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
5353
{% endif %}
5454
{% elif display_gitlab %}
5555
{% if check_meta and 'gitlab_url' in meta %}
5656
<!-- User defined GitLab URL -->
5757
<a href="{{ meta['gitlab_url'] }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
5858
{% else %}
59-
<a href="https://{{ gitlab_host|default("gitlab.com") }}/{{ gitlab_user }}/{{ gitlab_repo }}/blob/{{ gitlab_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
59+
<a href="https://{{ gitlab_host|default("gitlab.com") }}/{{ gitlab_user }}/{{ gitlab_repo }}/{{ theme_vcs_pageview_mode|default("blob") }}/{{ gitlab_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
6060
{% endif %}
6161
{% elif show_source and source_url_prefix %}
6262
<a href="{{ source_url_prefix }}{{ pagename }}{{ suffix }}">{{ _('View page source') }}</a>
@@ -74,7 +74,7 @@
7474
<a href="{{ next.link|e }}" class="btn btn-neutral float-right" title="{{ next.title|striptags|e }}" accesskey="n">Next <span class="fa fa-arrow-circle-right"></span></a>
7575
{% endif %}
7676
{% if prev %}
77-
<a href="{{ prev.link|e }}" class="btn btn-neutral" title="{{ prev.title|striptags|e }}" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
77+
<a href="{{ prev.link|e }}" class="btn btn-neutral float-left" title="{{ prev.title|striptags|e }}" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
7878
{% endif %}
7979
</div>
8080
{% endif %}

user_guide_src/source/_themes/sphinx_rtd_theme/footer.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<a href="{{ next.link|e }}" class="btn btn-neutral float-right" title="{{ next.title|striptags|e }}" accesskey="n" rel="next">{{ _('Next') }} <span class="fa fa-arrow-circle-right"></span></a>
66
{% endif %}
77
{% if prev %}
8-
<a href="{{ prev.link|e }}" class="btn btn-neutral" title="{{ prev.title|striptags|e }}" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> {{ _('Previous') }}</a>
8+
<a href="{{ prev.link|e }}" class="btn btn-neutral float-left" title="{{ prev.title|striptags|e }}" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> {{ _('Previous') }}</a>
99
{% endif %}
1010
</div>
1111
{% endif %}
@@ -16,9 +16,9 @@
1616
<p>
1717
{%- if show_copyright %}
1818
{%- if hasdoc('copyright') %}
19-
{% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}.{% endtrans %}
19+
{% trans path=pathto('copyright'), copyright=copyright|e %}&copy; <a href="{{ path }}">Copyright</a> {{ copyright }}{% endtrans %}
2020
{%- else %}
21-
{% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}.{% endtrans %}
21+
{% trans copyright=copyright|e %}&copy; Copyright {{ copyright }}{% endtrans %}
2222
{%- endif %}
2323
{%- endif %}
2424

@@ -36,14 +36,16 @@
3636
</span>
3737
{% endtrans %}
3838
{%- elif last_updated %}
39-
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
39+
<span class="lastupdated">
40+
{% trans last_updated=last_updated|e %}Last updated on {{ last_updated }}.{% endtrans %}
41+
</span>
4042
{%- endif %}
4143

4244
</p>
4345
</div>
4446

4547
{%- if show_sphinx %}
46-
{% trans %}Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>{% endtrans %}.
48+
{% trans %}Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>{% endtrans %}.
4749
{%- endif %}
4850

4951
{%- block extrafooter %} {% endblock %}

user_guide_src/source/_themes/sphinx_rtd_theme/layout.html

Lines changed: 91 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
{%- else %}
77
{%- set titlesuffix = "" %}
88
{%- endif %}
9+
{%- set lang_attr = 'en' if language == None else (language | replace('_', '-')) %}
910

1011
<!DOCTYPE html>
11-
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
12-
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
12+
<!--[if IE 8]><html class="no-js lt-ie9" lang="{{ lang_attr }}" > <![endif]-->
13+
<!--[if gt IE 8]><!--> <html class="no-js" lang="{{ lang_attr }}" > <!--<![endif]-->
1314
<head>
1415
<meta charset="utf-8">
1516
{{ metatags }}
@@ -27,71 +28,87 @@
2728
<link rel="canonical" href="{{ theme_canonical_url }}{{ pagename }}.html"/>
2829
{% endif %}
2930

30-
{# CSS #}
31-
32-
{# OPENSEARCH #}
33-
{% if not embedded %}
34-
{% if use_opensearch %}
35-
<link rel="search" type="application/opensearchdescription+xml" title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}" href="{{ pathto('_static/opensearch.xml', 1) }}"/>
31+
{# JAVASCRIPTS #}
32+
<script type="text/javascript" src="{{ pathto('_static/js/modernizr.min.js', 1) }}"></script>
33+
{%- if not embedded %}
34+
{# XXX Sphinx 1.8.0 made this an external js-file, quick fix until we refactor the template to inherert more blocks directly from sphinx #}
35+
{% if sphinx_version >= "1.8.0" %}
36+
<script type="text/javascript" id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
37+
{%- for scriptfile in script_files %}
38+
{{ js_tag(scriptfile) }}
39+
{%- endfor %}
40+
{% else %}
41+
<script type="text/javascript">
42+
var DOCUMENTATION_OPTIONS = {
43+
URL_ROOT:'{{ url_root }}',
44+
VERSION:'{{ release|e }}',
45+
LANGUAGE:'{{ language }}',
46+
COLLAPSE_INDEX:false,
47+
FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}',
48+
HAS_SOURCE: {{ has_source|lower }},
49+
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}'
50+
};
51+
</script>
52+
{%- for scriptfile in script_files %}
53+
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
54+
{%- endfor %}
3655
{% endif %}
56+
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script>
3757

38-
{% endif %}
39-
40-
{# RTD hosts this file, so just load on non RTD builds #}
41-
{% if not READTHEDOCS %}
42-
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
43-
{% endif %}
58+
{# OPENSEARCH #}
59+
{%- if use_opensearch %}
60+
<link rel="search" type="application/opensearchdescription+xml"
61+
title="{% trans docstitle=docstitle|e %}Search within {{ docstitle }}{% endtrans %}"
62+
href="{{ pathto('_static/opensearch.xml', 1) }}"/>
63+
{%- endif %}
64+
{%- endif %}
4465

45-
{% for cssfile in css_files %}
46-
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
47-
{% endfor %}
66+
{# CSS #}
67+
<link rel="stylesheet" href="{{ pathto('_static/' + style, 1) }}" type="text/css" />
68+
<link rel="stylesheet" href="{{ pathto('_static/pygments.css', 1) }}" type="text/css" />
69+
{%- for css in css_files %}
70+
{%- if css|attr("rel") %}
71+
<link rel="{{ css.rel }}" href="{{ pathto(css.filename, 1) }}" type="text/css"{% if css.title is not none %} title="{{ css.title }}"{% endif %} />
72+
{%- else %}
73+
<link rel="stylesheet" href="{{ pathto(css, 1) }}" type="text/css" />
74+
{%- endif %}
75+
{%- endfor %}
4876

49-
{% for cssfile in extra_css_files %}
77+
{%- for cssfile in extra_css_files %}
5078
<link rel="stylesheet" href="{{ pathto(cssfile, 1) }}" type="text/css" />
51-
{% endfor %}
79+
{%- endfor %}
5280

5381
{%- block linktags %}
5482
{%- if hasdoc('about') %}
55-
<link rel="author" title="{{ _('About these documents') }}"
56-
href="{{ pathto('about') }}"/>
83+
<link rel="author" title="{{ _('About these documents') }}" href="{{ pathto('about') }}" />
5784
{%- endif %}
5885
{%- if hasdoc('genindex') %}
59-
<link rel="index" title="{{ _('Index') }}"
60-
href="{{ pathto('genindex') }}"/>
86+
<link rel="index" title="{{ _('Index') }}" href="{{ pathto('genindex') }}" />
6187
{%- endif %}
6288
{%- if hasdoc('search') %}
63-
<link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}"/>
89+
<link rel="search" title="{{ _('Search') }}" href="{{ pathto('search') }}" />
6490
{%- endif %}
6591
{%- if hasdoc('copyright') %}
66-
<link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}"/>
67-
{%- endif %}
68-
<link rel="top" title="{{ docstitle|e }}" href="{{ pathto('index') }}"/>
69-
{%- if parents %}
70-
<link rel="up" title="{{ parents[-1].title|striptags|e }}" href="{{ parents[-1].link|e }}"/>
92+
<link rel="copyright" title="{{ _('Copyright') }}" href="{{ pathto('copyright') }}" />
7193
{%- endif %}
7294
{%- if next %}
73-
<link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}"/>
95+
<link rel="next" title="{{ next.title|striptags|e }}" href="{{ next.link|e }}" />
7496
{%- endif %}
7597
{%- if prev %}
76-
<link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}"/>
98+
<link rel="prev" title="{{ prev.title|striptags|e }}" href="{{ prev.link|e }}" />
7799
{%- endif %}
78100
{%- endblock %}
79101
{%- block extrahead %} {% endblock %}
80-
81-
{# Keep modernizr in head - http://modernizr.com/docs/#installing #}
82-
<script src="{{ pathto('_static/js/modernizr.min.js', 1) }}"></script>
83-
84102
</head>
85103

86-
<body class="wy-body-for-nav" role="document">
104+
<body class="wy-body-for-nav">
87105

88106
{% block extrabody %} {% endblock %}
89107
<div class="wy-grid-for-nav">
90-
91108
{# SIDE NAV, TOGGLES ON MOBILE #}
92109
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
93110
<div class="wy-side-scroll">
94-
<div class="wy-side-nav-search">
111+
<div class="wy-side-nav-search" {% if theme_style_nav_header_background %} style="background: {{theme_style_nav_header_background}}" {% endif %}>
95112
{% block sidebartitle %}
96113

97114
{% if logo and theme_logo_only %}
@@ -101,8 +118,10 @@
101118
{% endif %}
102119

103120
{% if logo %}
104-
{# Not strictly valid HTML, but it's the only way to display/scale it properly, without weird scripting or heaps of work #}
105-
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" />
121+
{# Not strictly valid HTML, but it's the only way to display/scale
122+
it properly, without weird scripting or heaps of work
123+
#}
124+
<img src="{{ pathto('_static/' + logo, 1) }}" class="logo" alt="Logo"/>
106125
{% endif %}
107126
</a>
108127

@@ -130,7 +149,10 @@
130149
toctree is empty. Skip building this for now.
131150
#}
132151
{% if 'singlehtml' not in builder %}
133-
{% set global_toc = toctree(maxdepth=theme_navigation_depth|int, collapse=theme_collapse_navigation, includehidden=True) %}
152+
{% set global_toc = toctree(maxdepth=theme_navigation_depth|int,
153+
collapse=theme_collapse_navigation|tobool,
154+
includehidden=theme_includehidden|tobool,
155+
titles_only=theme_titles_only|tobool) %}
134156
{% endif %}
135157
{% if global_toc %}
136158
{{ global_toc }}
@@ -146,65 +168,65 @@
146168
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
147169

148170
{# MOBILE NAV, TRIGGLES SIDE NAV ON TOGGLE #}
149-
<nav class="wy-nav-top" role="navigation" aria-label="top navigation">
171+
<nav class="wy-nav-top" aria-label="top navigation">
150172
{% block mobile_nav %}
151173
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
152174
<a href="{{ pathto(master_doc) }}">{{ project }}</a>
153175
{% endblock %}
154176
</nav>
155177

156178

157-
{# PAGE CONTENT #}
158179
<div class="wy-nav-content">
180+
{%- block content %}
181+
{% if theme_style_external_links|tobool %}
182+
<div class="rst-content style-external-links">
183+
{% else %}
159184
<div class="rst-content">
185+
{% endif %}
160186
{% include "breadcrumbs.html" %}
161187
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
188+
{%- block document %}
162189
<div itemprop="articleBody">
163190
{% block body %}{% endblock %}
164191
</div>
192+
{% if self.comments()|trim %}
165193
<div class="articleComments">
166194
{% block comments %}{% endblock %}
167195
</div>
196+
{% endif%}
168197
</div>
198+
{%- endblock %}
169199
{% include "footer.html" %}
170200
</div>
201+
{%- endblock %}
171202
</div>
172203

173204
</section>
174205

175206
</div>
176207
{% include "versions.html" %}
177208

178-
{% if not embedded %}
179-
180-
<script type="text/javascript">
181-
var DOCUMENTATION_OPTIONS = {
182-
URL_ROOT:'{{ url_root }}',
183-
VERSION:'{{ release|e }}',
184-
COLLAPSE_INDEX:false,
185-
FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}',
186-
HAS_SOURCE: {{ has_source|lower }},
187-
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}'
188-
};
189-
</script>
190-
{%- for scriptfile in script_files %}
191-
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
192-
{%- endfor %}
193-
194-
{% endif %}
195-
196-
{# RTD hosts this file, so just load on non RTD builds #}
197-
{% if not READTHEDOCS %}
198-
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script>
199-
{% endif %}
200-
201-
{# STICKY NAVIGATION #}
202-
{% if theme_sticky_navigation %}
203209
<script type="text/javascript">
204210
jQuery(function () {
205-
SphinxRtdTheme.StickyNav.enable();
211+
SphinxRtdTheme.Navigation.enable({{ 'true' if theme_sticky_navigation|tobool else 'false' }});
206212
});
207213
</script>
214+
215+
{# Do not conflict with RTD insertion of analytics script #}
216+
{% if not READTHEDOCS %}
217+
{% if theme_analytics_id %}
218+
<!-- Theme Analytics -->
219+
<script>
220+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
221+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
222+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
223+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
224+
225+
ga('create', '{{ theme_analytics_id }}', 'auto');
226+
ga('send', 'pageview');
227+
</script>
228+
229+
{% endif %}
208230
{% endif %}
209231

210232
{%- block footer %} {% endblock %}

0 commit comments

Comments
 (0)