Skip to content

Commit 6da7eb9

Browse files
authored
Merge branch 'master' into fix-pygments
2 parents 2f8946f + 9d704f2 commit 6da7eb9

File tree

8 files changed

+39
-20
lines changed

8 files changed

+39
-20
lines changed

README.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@
99
.. _demo: http://docs.readthedocs.org
1010
.. _hidden: http://sphinx-doc.org/markup/toctree.html
1111

12+
.. image:: https://img.shields.io/pypi/v/sphinx_rtd_theme.svg
13+
:target: https://pypi.python.org/pypi/sphinx_rtd_theme
14+
.. image:: https://travis-ci.org/rtfd/sphinx_rtd_theme.svg?branch=master
15+
:target: https://travis-ci.org/rtfd/sphinx_rtd_theme
16+
.. image:: https://img.shields.io/pypi/l/sphinx_rtd_theme.svg
17+
:target: https://pypi.python.org/pypi/sphinx_rtd_theme/
18+
:alt: license
19+
1220
**************************
1321
Read the Docs Sphinx Theme
1422
**************************

js/theme.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,15 @@ function ThemeNav () {
108108
// Try again with the closest section entry.
109109
link = $('.wy-menu-vertical')
110110
.find('[href="#' + closest_section.attr("id") + '"]');
111-
112111
}
113-
$('.wy-menu-vertical li.toctree-l1 li.current')
114-
.removeClass('current');
115-
link.closest('li.toctree-l2').addClass('current');
116-
link.closest('li.toctree-l3').addClass('current');
117-
link.closest('li.toctree-l4').addClass('current');
112+
// If we found a matching link then reset current and re-apply
113+
// otherwise retain the existing match
114+
if (link.length > 0) {
115+
$('.wy-menu-vertical li.toctree-l1 li.current').removeClass('current');
116+
link.closest('li.toctree-l2').addClass('current');
117+
link.closest('li.toctree-l3').addClass('current');
118+
link.closest('li.toctree-l4').addClass('current');
119+
}
118120
}
119121
catch (err) {
120122
console.log("Error expanding nav for anchor", err);

sass/_theme_rst.sass

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
.literal-block, pre.literal-block
5151
@extend .codeblock
5252
// These are the various note pullouts that sphinx applies
53-
.note, .attention, .caution, .danger, .error, .hint, .important, .tip, .warning, .seealso, .admonition-todo
53+
.note, .attention, .caution, .danger, .error, .hint, .important, .tip, .warning, .seealso, .admonition-todo, .admonition
5454
@extend .wy-alert
5555
.last
5656
margin-bottom: 0
@@ -119,7 +119,7 @@
119119
display: inline-block
120120
&:hover .headerlink
121121
display: inline-block
122-
122+
123123
.centered
124124
text-align: center
125125

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
.. _github: https://www.github.com/snide/sphinx_rtd_theme
55
66
"""
7+
from io import open
78
from setuptools import setup
89
from sphinx_rtd_theme import __version__
910

@@ -16,7 +17,7 @@
1617
author='Dave Snider',
1718
author_email='[email protected]',
1819
description='Read the Docs theme for Sphinx',
19-
long_description=open('README.rst').read(),
20+
long_description=open('README.rst', encoding='utf-8').read(),
2021
zip_safe=False,
2122
packages=['sphinx_rtd_theme'],
2223
package_data={'sphinx_rtd_theme': [
@@ -34,6 +35,8 @@
3435
]
3536
},
3637
classifiers=[
38+
'Framework :: Sphinx',
39+
'Framework :: Sphinx :: Theme',
3740
'Development Status :: 5 - Production/Stable',
3841
'License :: OSI Approved :: MIT License',
3942
'Environment :: Console',

sphinx_rtd_theme/__init__.py

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

88
__version__ = '0.2.5b1'
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+
# See http://www.sphinx-doc.org/en/stable/theming.html#distribute-your-theme-as-a-python-package
18+
def setup(app):
19+
app.add_html_theme('sphinx_rtd_theme', path.abspath(path.dirname(__file__)))

sphinx_rtd_theme/static/css/theme.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sphinx_rtd_theme/static/css/theme.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sphinx_rtd_theme/static/js/theme.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,15 @@ function ThemeNav () {
109109
// Try again with the closest section entry.
110110
link = $('.wy-menu-vertical')
111111
.find('[href="#' + closest_section.attr("id") + '"]');
112-
113112
}
114-
$('.wy-menu-vertical li.toctree-l1 li.current')
115-
.removeClass('current');
116-
link.closest('li.toctree-l2').addClass('current');
117-
link.closest('li.toctree-l3').addClass('current');
118-
link.closest('li.toctree-l4').addClass('current');
113+
// If we found a matching link then reset current and re-apply
114+
// otherwise retain the existing match
115+
if (link.length > 0) {
116+
$('.wy-menu-vertical li.toctree-l1 li.current').removeClass('current');
117+
link.closest('li.toctree-l2').addClass('current');
118+
link.closest('li.toctree-l3').addClass('current');
119+
link.closest('li.toctree-l4').addClass('current');
120+
}
119121
}
120122
catch (err) {
121123
console.log("Error expanding nav for anchor", err);

0 commit comments

Comments
 (0)