Skip to content

Commit dee9cb3

Browse files
🐛 FIX: Replace add_javascript by add_js for sphinx>=3 (#77)
Co-authored-by: Chris Sewell <[email protected]>
1 parent c0b6197 commit dee9cb3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

codecov.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
threshold: 0.5%

sphinx_tabs/tabs.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import json
55
import os
66
import posixpath
7+
import sphinx
78
from docutils import nodes
89
from docutils.parsers.rst import Directive, directives
910
from pkg_resources import resource_filename
@@ -346,7 +347,11 @@ def setup(app):
346347
if "add_script_file" in dir(app):
347348
app.add_script_file(path)
348349
else:
349-
app.add_javascript(path)
350+
# check sphinx version for backward compatibility
351+
if sphinx.version_info >= (3, 0):
352+
app.add_js_file(path)
353+
else:
354+
app.add_javascript(path)
350355
app.connect("html-page-context", update_context)
351356
app.connect("build-finished", copy_assets)
352357

0 commit comments

Comments
 (0)