Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 332324c

Browse files
ImportanceOfBeingErnestMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR #12216: Doc: Fix search for sphinx >=1.8
1 parent b8e2e1b commit 332324c

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

doc/_templates/layout.html

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,27 @@ <h3>{{ _('Navigation') }}</h3>
7676
{%- endmacro %}
7777

7878
{%- macro script() %}
79-
<script type="text/javascript">
80-
var DOCUMENTATION_OPTIONS = {
81-
URL_ROOT: '{{ url_root }}',
82-
VERSION: '{{ release|e }}',
83-
COLLAPSE_INDEX: false,
84-
FILE_SUFFIX: '{{ '' if no_search_suffix else file_suffix }}',
85-
HAS_SOURCE: {{ has_source|lower }},
86-
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}'
87-
};
88-
</script>
89-
{%- for scriptfile in script_files %}
90-
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
91-
{%- endfor %}
79+
{% if sphinx_version >= "1.8.0" %}
80+
<script type="text/javascript" id="documentation_options" data-url_root="{{ pathto('', 1) }}" src="{{ pathto('_static/documentation_options.js', 1) }}"></script>
81+
{%- for scriptfile in script_files %}
82+
{{ js_tag(scriptfile) }}
83+
{%- endfor %}
84+
{% else %}
85+
<script type="text/javascript">
86+
var DOCUMENTATION_OPTIONS = {
87+
URL_ROOT:'{{ url_root }}',
88+
VERSION:'{{ release|e }}',
89+
LANGUAGE:'{{ language }}',
90+
COLLAPSE_INDEX:false,
91+
FILE_SUFFIX:'{{ '' if no_search_suffix else file_suffix }}',
92+
HAS_SOURCE: {{ has_source|lower }},
93+
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}'
94+
};
95+
</script>
96+
{%- for scriptfile in script_files %}
97+
<script type="text/javascript" src="{{ pathto(scriptfile, 1) }}"></script>
98+
{%- endfor %}
99+
{% endif %}
92100
{%- endmacro %}
93101

94102
{%- macro css() %}

0 commit comments

Comments
 (0)