Skip to content

Commit b2323ce

Browse files
authored
Merge branch 'master' into Blendify/python-compat
2 parents 60a094b + 71d6d18 commit b2323ce

File tree

12 files changed

+135
-103
lines changed

12 files changed

+135
-103
lines changed

README.rst

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,15 @@ This theme is distributed on PyPI_ and can be installed with ``pip``:
3333
3434
$ pip install sphinx-rtd-theme
3535
36-
To use the theme in your Sphinx project, you will need to add the following to
37-
your ``conf.py`` file:
36+
To use the theme in your Sphinx project, you will need to edit
37+
your ``conf.py`` file's ``html_theme`` setting:
3838

3939
.. code:: python
4040
41-
import sphinx_rtd_theme
42-
43-
extensions = [
44-
...
45-
"sphinx_rtd_theme",
46-
]
47-
4841
html_theme = "sphinx_rtd_theme"
4942
50-
For more information read the full documentation on `installing the theme`_
43+
For more information, including a full example with localized strings enabled,
44+
read the documentation on `installing the theme`_.
5145

5246
.. _PyPI: https://pypi.python.org/pypi/sphinx_rtd_theme
5347
.. _installing the theme: https://sphinx-rtd-theme.readthedocs.io/en/latest/installing.html

docs/conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@
1010
sys.path.append(os.path.abspath('./demo/'))
1111

1212
import sphinx_rtd_theme
13+
from sphinx_rtd_theme import __version__ as theme_version
14+
from sphinx_rtd_theme import __version_full__ as theme_version_full
1315
from sphinx.locale import _
1416

1517
project = u'Read the Docs Sphinx Theme'
1618
slug = re.sub(r'\W+', '-', project.lower())
17-
version = '0.5.1'
18-
release = '0.5.1'
19+
version = theme_version
20+
release = theme_version_full
1921
author = u'Dave Snider, Read the Docs, Inc. & contributors'
2022
copyright = author
2123
language = 'en'

docs/configuring.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ For example:
1313
.. code:: python
1414
1515
html_theme_options = {
16-
'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard
16+
'analytics_id': 'G-XXXXXXXXXX', # Provided by Google in your dashboard
1717
'analytics_anonymize_ip': False,
1818
'logo_only': False,
1919
'display_version': True,
@@ -96,11 +96,13 @@ Miscellaneous options
9696

9797
.. confval:: analytics_id
9898

99-
If specified, Google Analytics' javascript is included in your pages.
100-
Set the value to the ID provided to you by google (like ``UA-XXXXXXX``).
99+
If specified, Google Analytics' `gtag.js`_ is included in your pages.
100+
Set the value to the ID provided to you by google (like ``UA-XXXXXXX`` or ``G-XXXXXXXXXX``).
101101

102102
:type: string
103103

104+
.. _gtag.js: https://developers.google.com/gtagjs
105+
104106
.. confval:: analytics_anonymize_ip
105107

106108
Anonymize visitor IP addresses in Google Analytics.

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.5.1
2+
current_version = 0.5.2
33
commit = false
44
tag = false
55
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>[a-z]+)(?P<dev>\d+))?

sphinx_rtd_theme/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from sphinx.util.logging import getLogger
1313

1414

15-
__version__ = '0.5.1'
15+
__version__ = '0.5.2'
1616
__version_full__ = __version__
1717

1818
logger = getLogger(__name__)
@@ -55,4 +55,10 @@ def setup(app):
5555
app.add_message_catalog('sphinx', rtd_locale_path)
5656
app.connect('config-inited', config_initiated)
5757

58+
# sphinx emits the permalink icon for headers, so choose one more in keeping with our theme
59+
if sphinx_version >= (3, 5, 0):
60+
app.config.html_permalinks_icon = "\uf0c1"
61+
else:
62+
app.config.html_add_permalinks = "\uf0c1"
63+
5864
return {'parallel_read_safe': True, 'parallel_write_safe': True}

sphinx_rtd_theme/layout.html

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@
5757
{%- if not embedded %}
5858
{# 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 #}
5959
{%- if sphinx_version >= "1.8.0" -%}
60-
<script type="text/javascript" id="documentation_options" data-url_root="{{ url_root }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
60+
<script id="documentation_options" data-url_root="{{ url_root }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
6161
{%- for scriptfile in script_files %}
6262
{{ js_tag(scriptfile) }}
6363
{%- endfor %}
6464
{%- else %}
65-
<script type="text/javascript">
65+
<script>
6666
var DOCUMENTATION_OPTIONS = {
6767
URL_ROOT:'{{ url_root }}',
6868
VERSION:'{{ release|e }}',
@@ -74,10 +74,10 @@
7474
};
7575
</script>
7676
{%- for scriptfile in script_files %}
77-
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
77+
<script src="{{ pathto(scriptfile, 1) }}"></script>
7878
{%- endfor %}
7979
{%- endif %}
80-
<script type="text/javascript" src="{{ pathto('_static/js/theme.js', 1) }}"></script>
80+
<script src="{{ pathto('_static/js/theme.js', 1) }}"></script>
8181

8282
{#- OPENSEARCH #}
8383
{%- if use_opensearch %}
@@ -174,7 +174,7 @@
174174
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">
175175

176176
{#- MOBILE NAV, TRIGGLES SIDE NAV ON TOGGLE #}
177-
<nav class="wy-nav-top" aria-label="{{ _('Top') }}">
177+
<nav class="wy-nav-top" aria-label="{{ _('Top') }}" {% if theme_style_nav_header_background %} style="background: {{theme_style_nav_header_background}}" {% endif %}>
178178
{%- block mobile_nav %}
179179
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
180180
<a href="{{ pathto(master_doc) }}">{{ project }}</a>
@@ -209,7 +209,7 @@
209209
</div>
210210
{% include "versions.html" -%}
211211

212-
<script type="text/javascript">
212+
<script>
213213
jQuery(function () {
214214
SphinxRtdTheme.Navigation.enable({{ 'true' if theme_sticky_navigation|tobool else 'false' }});
215215
});
@@ -219,17 +219,15 @@
219219
{%- if not READTHEDOCS %}
220220
{%- if theme_analytics_id %}
221221
<!-- Theme Analytics -->
222+
<script async src="https://www.googletagmanager.com/gtag/js?id={{ theme_analytics_id }}"></script>
222223
<script>
223-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
224-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
225-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
226-
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
227-
228-
ga('create', '{{ theme_analytics_id }}', 'auto');
229-
{%- if theme_analytics_anonymize_ip|tobool %}
230-
ga('set', 'anonymizeIp', true);
231-
{%- endif %}
232-
ga('send', 'pageview');
224+
window.dataLayer = window.dataLayer || [];
225+
function gtag(){dataLayer.push(arguments);}
226+
gtag('js', new Date());
227+
228+
gtag('config', '{{ theme_analytics_id }}', {
229+
'anonymize_ip': {{ 'true' if theme_analytics_anonymize_ip|tobool else 'false' }},
230+
});
233231
</script>
234232

235233
{%- endif %}

sphinx_rtd_theme/search.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
{% set display_vcs_links = False %}
1313
{%- block scripts %}
1414
{{ super() }}
15-
<script type="text/javascript" src="{{ pathto('_static/searchtools.js', 1) }}"></script>
16-
<script type="text/javascript" src="{{ pathto('_static/language_data.js', 1) }}"></script>
15+
<script src="{{ pathto('_static/searchtools.js', 1) }}"></script>
16+
<script src="{{ pathto('_static/language_data.js', 1) }}"></script>
1717
{%- endblock %}
1818
{% block footer %}
19-
<script type="text/javascript">
19+
<script>
2020
jQuery(function() { Search.loadIndex("{{ pathto('searchindex.js', 1) }}"); });
2121
</script>
2222
{# this is used when loading the search index using $.ajax fails,
2323
such as on Chrome for documents on localhost #}
24-
<script type="text/javascript" id="searchindexloader"></script>
24+
<script id="searchindexloader"></script>
2525
{{ super() }}
2626
{% endblock %}
2727
{% block body %}

src/sass/_theme_badge_fa.sass

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ ul.fas
3030
text-indent: -0.8em
3131
li
3232
.fa
33-
width: .8em
33+
width: 0.8em
3434
.fa-large:before,
3535
.fa-large:before
3636
/* 1.5 increased font size for fa-large * 1.25 width

0 commit comments

Comments
 (0)