Skip to content

Commit fc34b38

Browse files
authored
Merge pull request readthedocs#46 from readthedocs/humitos/sphinx-3
Compatibility with Sphinx 3.0.0
2 parents 4bf03f2 + 331ba0d commit fc34b38

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

hoverxref/extension.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import inspect
33
import types
44
from docutils import nodes
5+
import sphinx
56
from sphinx.roles import XRefRole
67
from sphinx.util.fileutil import copy_asset
78

@@ -101,7 +102,13 @@ def setup_sphinx_tabs(app, config):
101102
Sphinx Tabs removes the CSS/JS from pages that does not use the directive.
102103
Although, we need them to use inside the tooltip.
103104
"""
104-
listeners = list(app.events.listeners.get('html-page-context').items())
105+
if sphinx.version_info < (3, 0, 0):
106+
listeners = list(app.events.listeners.get('html-page-context').items())
107+
else:
108+
listeners = [
109+
(listener.id, listener.handler)
110+
for listener in app.events.listeners.get('html-page-context')
111+
]
105112
for listener_id, function in listeners:
106113
module_name = inspect.getmodule(function).__name__
107114
if module_name == 'sphinx_tabs.tabs':

tox.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tox]
22
envlist =
33
docs
4-
py{36,37,38}-sphinx{18,20,21,22,23,24}
4+
py{36,37,38}-sphinx{18,20,21,22,23,24,30}
55

66
[testenv]
77
deps =
@@ -14,9 +14,10 @@ deps =
1414
sphinx22: sphinx~=2.2.0
1515
sphinx23: sphinx~=2.3.0
1616
sphinx24: sphinx~=2.4.0
17+
sphinx30: sphinx~=3.0.0
1718
commands = pytest {posargs}
1819

19-
[testenv:py38-sphinx24]
20+
[testenv:py38-sphinx30]
2021
deps =
2122
{[testenv]deps}
2223
pytest-cov

0 commit comments

Comments
 (0)