[IMP] technical: remove warning about scripts assets

Before this commit, the following warning was displayed at compilation: "RemovedInSphinx30Warning: To modify script_files in the theme is deprecated. Please insert a <script> tag directly in your theme instead."
This commit is contained in:
Arnaud Joset 2020-02-06 13:37:33 +01:00 committed by Antoine Vandevenne (anv)
parent 142e1926f3
commit 8a0f371531
2 changed files with 13 additions and 8 deletions

View File

@ -1,11 +1,11 @@
{% extends "basic/layout.html" %}
{% set script_files = script_files + [
'_static/jquery.min.js',
'_static/bootstrap.js',
'_static/doc.js',
'_static/jquery.noconflict.js',
] %}
{%- block scripts %}
{{ super() }}
<script type="text/javascript" src="{{ pathto('_static/jquery.min.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('_static/bootstrap.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('_static/doc.js', 1) }}"></script>
<script type="text/javascript" src="{{ pathto('_static/jquery.noconflict.js', 1) }}"></script>
{%- endblock %}
{% set classes = [] %}
{% if pagename == master_doc %}

View File

@ -4,7 +4,7 @@ import posixpath
import re
from docutils import nodes
from sphinx import addnodes, util
from sphinx import addnodes, util, builders
from sphinx.locale import admonitionlabels
try:
@ -42,6 +42,11 @@ class BootstrapTranslator(nodes.NodeVisitor, object):
]
def __init__(self, builder, document):
# order of parameter swapped between Sphinx 1.x and 2.x, check if
# we're running 1.x and swap back
if not isinstance(builder, builders.Builder):
builder, document = document, builder
super(BootstrapTranslator, self).__init__(document)
self.builder = builder
self.body = []