Skip to content

Commit e063bba

Browse files
authored
Merge branch 'master' into blendify/kbd
2 parents 27f8c68 + c27ac29 commit e063bba

File tree

16 files changed

+146
-55
lines changed

16 files changed

+146
-55
lines changed

.circleci/config.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
version: 2.1
2+
3+
commands:
4+
run-tox:
5+
description: "Run tox"
6+
parameters:
7+
version:
8+
type: string
9+
steps:
10+
- checkout
11+
- run: pip install --user tox
12+
- run: tox -e "<<parameters.version>>-sphinx{16,17,18,20,21,22,23,24,30,31,32}"
13+
14+
jobs:
15+
py27:
16+
docker:
17+
- image: 'cimg/python:2.7'
18+
steps:
19+
- run-tox:
20+
version: py27
21+
py36:
22+
docker:
23+
- image: 'cimg/python:3.6'
24+
steps:
25+
- run-tox:
26+
version: py36
27+
py37:
28+
docker:
29+
- image: 'cimg/python:3.7'
30+
steps:
31+
- run-tox:
32+
version: py37
33+
py38:
34+
docker:
35+
- image: 'cimg/python:3.8'
36+
steps:
37+
- run-tox:
38+
version: py38
39+
py39:
40+
docker:
41+
- image: 'cimg/python:3.9'
42+
steps:
43+
- run-tox:
44+
version: py39
45+
46+
workflows:
47+
version: 2
48+
tests:
49+
jobs:
50+
- py39
51+
- py38
52+
- py37
53+
- py36
54+
- py27

.readthedocs.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
version: 2
2+
23
python:
3-
version: 3.6
4+
version: 3
45
install:
56
- requirements: docs/requirements.txt
7+
8+
sphinx:
9+
configuration: docs/conf.py

.travis.yml

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

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
include *.txt
22
include babel.cfg
33
include LICENSE
4+
include bin/preinstall.js
45
recursive-include sphinx_rtd_theme *.conf
56
recursive-include sphinx_rtd_theme *.css
67
recursive-include sphinx_rtd_theme *.eot

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Read the Docs Sphinx Theme
55
.. image:: https://img.shields.io/pypi/v/sphinx_rtd_theme.svg
66
:target: https://pypi.python.org/pypi/sphinx_rtd_theme
77
:alt: Pypi Version
8-
.. image:: https://travis-ci.org/readthedocs/sphinx_rtd_theme.svg?branch=master
9-
:target: https://travis-ci.org/readthedocs/sphinx_rtd_theme
8+
.. image:: https://circleci.com/gh/readthedocs/sphinx_rtd_theme.svg?style=svg
109
:alt: Build Status
10+
:target: https://circleci.com/gh/readthedocs/sphinx_rtd_theme
1111
.. image:: https://img.shields.io/pypi/l/sphinx_rtd_theme.svg
1212
:target: https://pypi.python.org/pypi/sphinx_rtd_theme/
1313
:alt: License

docs/changelog.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@ Changelog
55
master
66
======
77

8+
Other Changes
9+
-------------
10+
11+
* The ``canonical_url`` option was deprecated in favor of Sphinx's ``html_baseurl``.
12+
13+
New Features
14+
------------
15+
16+
* New theme option to enable anonymous ip addresses when using Google Analytics (#889)
17+
18+
819
v0.5.0
920
======
1021

docs/configuring.rst

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ For example:
1313
.. code:: python
1414
1515
html_theme_options = {
16-
'canonical_url': '',
1716
'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard
17+
'analytics_anonymize_ip': False,
1818
'logo_only': False,
1919
'display_version': True,
2020
'prev_next_buttons_location': 'bottom',
@@ -101,6 +101,13 @@ Miscellaneous options
101101
If specified, Google Analytics' javascript is included in your pages.
102102
Set the value to the ID provided to you by google (like ``UA-XXXXXXX``).
103103

104+
.. confval:: analytics_anonymize_ip
105+
106+
:type: boolean
107+
:default: ``False``
108+
109+
Anonymize visitor IP addresses in Google Analytics.
110+
104111
.. confval:: canonical_url
105112

106113
:type: URL
@@ -111,6 +118,12 @@ Miscellaneous options
111118
documentation is available through. The URL points to the root path of the
112119
documentation and requires a trailing slash.
113120

121+
.. deprecated:: 0.6.0
122+
123+
Use :confval:`sphinx:html_baseurl` instead.
124+
125+
.. _canonical URL: https://en.wikipedia.org/wiki/Canonical_link_element
126+
114127
.. confval:: display_version
115128

116129
:type: boolean
@@ -157,10 +170,7 @@ Miscellaneous options
157170
:default: ``#2980B9``
158171

159172
Changes the background of the search area in the navigation bar. The value
160-
can be anything valid in a CSS `background` property.
161-
162-
.. _canonical URL: https://en.wikipedia.org/wiki/Canonical_link_element
163-
173+
can be anything valid in a CSS `background` property.
164174

165175
File-wide metadata
166176
==================

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
"""`sphinx_rtd_theme` lives on `Github`_.
33
4-
.. _github: https://github.com/rtfd/sphinx_rtd_theme
4+
.. _github: https://github.com/readthedocs/sphinx_rtd_theme
55
66
"""
77

@@ -86,7 +86,7 @@ def run(self):
8686
setup(
8787
name='sphinx_rtd_theme',
8888
version='0.5.0',
89-
url='https://github.com/rtfd/sphinx_rtd_theme/',
89+
url='https://github.com/readthedocs/sphinx_rtd_theme',
9090
license='MIT',
9191
author='Dave Snider, Read the Docs, Inc. & contributors',
9292
author_email='[email protected]',

sphinx_rtd_theme/__init__.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,47 @@
66

77
from os import path
88

9-
import sphinx
9+
from sphinx import version_info
10+
from sphinx.locale import _
11+
12+
try:
13+
# Avaliable from Sphinx 1.6
14+
from sphinx.util.logging import getLogger
15+
except ImportError:
16+
from logging import getLogger
1017

1118

1219
__version__ = '0.5.0'
1320
__version_full__ = __version__
1421

22+
logger = getLogger(__name__)
23+
1524

1625
def get_html_theme_path():
1726
"""Return list of HTML theme paths."""
1827
cur_dir = path.abspath(path.dirname(path.dirname(__file__)))
1928
return cur_dir
2029

2130

31+
def config_initiated(app, config):
32+
theme_options = config.html_theme_options or {}
33+
if theme_options.get('canonical_url'):
34+
logger.warning(
35+
_('The canonical_url option is deprecated, use the html_baseurl option from Sphinx instead.')
36+
)
37+
38+
2239
# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package
2340
def setup(app):
24-
if sphinx.version_info >= (1, 6, 0):
41+
if version_info >= (1, 6, 0):
2542
# Register the theme that can be referenced without adding a theme path
2643
app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__)))
2744

28-
if sphinx.version_info >= (1, 8, 0):
45+
if version_info >= (1, 8, 0):
2946
# Add Sphinx message catalog for newer versions of Sphinx
3047
# See http://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx.application.Sphinx.add_message_catalog
3148
rtd_locale_path = path.join(path.abspath(path.dirname(__file__)), 'locale')
3249
app.add_message_catalog('sphinx', rtd_locale_path)
50+
app.connect('config-inited', config_initiated)
3351

3452
return {'parallel_read_safe': True, 'parallel_write_safe': True}

sphinx_rtd_theme/breadcrumbs.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,21 @@
4444
<!-- User defined GitHub URL -->
4545
<a href="{{ meta['github_url'] }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
4646
{% else %}
47-
<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>
47+
<a href="https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ github_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ github_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-github"> {{ _('Edit on GitHub') }}</a>
4848
{% endif %}
4949
{% elif display_bitbucket %}
5050
{% if check_meta and 'bitbucket_url' in meta %}
5151
<!-- User defined Bitbucket URL -->
5252
<a href="{{ meta['bitbucket_url'] }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
5353
{% else %}
54-
<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>
54+
<a href="https://bitbucket.org/{{ bitbucket_user }}/{{ bitbucket_repo }}/src/{{ bitbucket_version}}{{ conf_py_path }}{{ pagename }}{{ suffix }}?mode={{ theme_vcs_pageview_mode or "view" }}" class="fa fa-bitbucket"> {{ _('Edit on Bitbucket') }}</a>
5555
{% endif %}
5656
{% elif display_gitlab %}
5757
{% if check_meta and 'gitlab_url' in meta %}
5858
<!-- User defined GitLab URL -->
5959
<a href="{{ meta['gitlab_url'] }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
6060
{% else %}
61-
<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>
61+
<a href="https://{{ gitlab_host|default("gitlab.com") }}/{{ gitlab_user }}/{{ gitlab_repo }}/{{ theme_vcs_pageview_mode or "blob" }}/{{ gitlab_version }}{{ conf_py_path }}{{ pagename }}{{ suffix }}" class="fa fa-gitlab"> {{ _('Edit on GitLab') }}</a>
6262
{% endif %}
6363
{% elif show_source and source_url_prefix %}
6464
<a href="{{ source_url_prefix }}{{ pagename }}{{ suffix }}">{{ _('View page source') }}</a>
@@ -73,10 +73,10 @@
7373
{% if (theme_prev_next_buttons_location == 'top' or theme_prev_next_buttons_location == 'both') and (next or prev) %}
7474
<div class="rst-breadcrumbs-buttons" role="navigation" aria-label="breadcrumb navigation">
7575
{% if next %}
76-
<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>
76+
<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" aria-hidden="true"></span></a>
7777
{% endif %}
7878
{% if prev %}
79-
<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>
79+
<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" aria-hidden="true"></span> {{ _('Previous') }}</a>
8080
{% endif %}
8181
</div>
8282
{% endif %}

0 commit comments

Comments
 (0)