From 7871fda09c0d31219b6e3fd95ec67b949eb23a5a Mon Sep 17 00:00:00 2001 From: Hsiaoming Yang Date: Tue, 29 Jan 2019 15:52:42 +0900 Subject: [PATCH] Fix scripts for search. ref: https://github.com/typlog/sphinx-typlog-theme/issues/16 --- sphinx_typlog_theme/layout.html | 2 ++ sphinx_typlog_theme/scripts.html | 41 +++++++++++++++++++------------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/sphinx_typlog_theme/layout.html b/sphinx_typlog_theme/layout.html index 287c4b9..7c9afb3 100644 --- a/sphinx_typlog_theme/layout.html +++ b/sphinx_typlog_theme/layout.html @@ -62,7 +62,9 @@ {%- endif %} {%- endblock %} + {%- block scripts %} {%- include "scripts.html" %} + {%- endblock %} {%- if theme_meta_html %}{{ theme_meta_html }}{% endif %} {%- block extrahead %}{% endblock %} diff --git a/sphinx_typlog_theme/scripts.html b/sphinx_typlog_theme/scripts.html index 5e64d5d..2535cce 100644 --- a/sphinx_typlog_theme/scripts.html +++ b/sphinx_typlog_theme/scripts.html @@ -1,16 +1,25 @@ -{% if not embedded %} - -{%- for scriptfile in script_files %} - -{%- endfor %} -{% endif %} +{%- if not embedded %} + +{%- if sphinx_version >= "1.8.0" %} + + {%- for scriptfile in script_files %} + {{ js_tag(scriptfile) }} + {%- endfor %} +{%- else %} + + {%- for scriptfile in script_files %} + + {%- endfor %} +{%- endif %} + +{%- endif %}