Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move language-specific data into a new JS file, language_data.js #5590

Merged
merged 1 commit into from
Nov 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
epub_exclude_files = ['_static/opensearch.xml', '_static/doctools.js',
'_static/jquery.js', '_static/searchtools.js',
'_static/underscore.js', '_static/basic.css',
'_static/language_data.js',
'search.html', '_static/websupport.js']
epub_fix_images = False
epub_max_image_width = 0
Expand Down
1 change: 1 addition & 0 deletions sphinx/builders/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@ def init_js_files(self):
self.add_js_file('jquery.js')
self.add_js_file('underscore.js')
self.add_js_file('doctools.js')
self.add_js_file('language_data.js')

for filename, attrs in self.app.registry.js_files:
self.add_js_file(filename, **attrs)
Expand Down
14 changes: 0 additions & 14 deletions sphinx/themes/basic/static/documentation_options.js_t
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,4 @@ var DOCUMENTATION_OPTIONS = {
HAS_SOURCE: {{ has_source|lower }},
SOURCELINK_SUFFIX: '{{ sourcelink_suffix }}',
NAVIGATION_WITH_KEYS: {{ 'true' if theme_navigation_with_keys|tobool else 'false'}},
SEARCH_LANGUAGE_STOP_WORDS: {{ search_language_stop_words }}
};


{% if search_language_stemming_code %}
/* Non-minified version JS is _stemmer.js if file is provided */ {% endif -%}
{{ search_language_stemming_code|safe }}

{% if search_scorer_tool %}
{{ search_scorer_tool|safe }}
{% endif -%}

{% if search_word_splitter_code %}
{{ search_word_splitter_code }}
{% endif -%}
25 changes: 25 additions & 0 deletions sphinx/themes/basic/static/language_data.js_t
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* language_data.js
* ~~~~~~~~~~~~~~~~
*
* This script contains the language-specific data used by searchtools.js,
* namely the list of stopwords, stemmer, scorer and splitter.
*
* :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
* :license: BSD, see LICENSE for details.
*
*/

var stopwords = {{ search_language_stop_words }};

{% if search_language_stemming_code %}
/* Non-minified version JS is _stemmer.js if file is provided */ {% endif -%}
{{ search_language_stemming_code|safe }}

{% if search_scorer_tool %}
{{ search_scorer_tool|safe }}
{% endif -%}

{% if search_word_splitter_code %}
{{ search_word_splitter_code }}
{% endif -%}
1 change: 0 additions & 1 deletion sphinx/themes/basic/static/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,6 @@ var Search = {
*/
query : function(query) {
var i;
var stopwords = DOCUMENTATION_OPTIONS.SEARCH_LANGUAGE_STOP_WORDS;

// stem the searchterms and add them to the correct list
var stemmer = new Stemmer();
Expand Down