File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 1
1
import os
2
+ import inspect
2
3
from docutils import nodes
3
4
from sphinx .domains .python import PythonDomain
4
5
from sphinx .domains .std import StandardDomain
@@ -194,6 +195,19 @@ def setup_domains(app, config):
194
195
app .add_domain (HoverXRefPythonDomain , override = True )
195
196
196
197
198
+ def setup_sphinx_tabs (app , config ):
199
+ """
200
+ Disconnect ``update_context`` function from ``sphinx-tabs``.
201
+
202
+ Sphinx Tabs removes the CSS/JS from pages that does not use the directive.
203
+ Although, we need them to use inside the tooltip.
204
+ """
205
+ for listener_id , function in app .events .listeners .get ('html-page-context' ).items ():
206
+ module_name = inspect .getmodule (function ).__name__
207
+ if module_name == 'sphinx_tabs.tabs' :
208
+ app .disconnect (listener_id )
209
+
210
+
197
211
def setup (app ):
198
212
"""Setup ``hoverxref`` Sphinx extension."""
199
213
@@ -225,6 +239,7 @@ def setup(app):
225
239
app .set_translator ('readthedocs' , HoverXRefHTMLTranslator , override = True )
226
240
227
241
app .connect ('config-inited' , setup_domains )
242
+ app .connect ('config-inited' , setup_sphinx_tabs )
228
243
app .connect ('build-finished' , copy_asset_files )
229
244
230
245
for f in ASSETS_FILES :
You can’t perform that action at this time.
0 commit comments