mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix JS search when html_copy_source is off.
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -1,6 +1,8 @@
|
|||||||
Release 0.5.1 (in development)
|
Release 0.5.1 (in development)
|
||||||
==============================
|
==============================
|
||||||
|
|
||||||
|
* Fix the JavaScript search when html_copy_source is off.
|
||||||
|
|
||||||
* Fix a bug in autodoc when documenting classes with the option.
|
* Fix a bug in autodoc when documenting classes with the option.
|
||||||
``autoclass_content = "both"`` set.
|
``autoclass_content = "both"`` set.
|
||||||
|
|
||||||
|
|||||||
@@ -393,6 +393,12 @@ that use Sphinx' HTMLWriter class.
|
|||||||
If true, the reST sources are included in the HTML build as
|
If true, the reST sources are included in the HTML build as
|
||||||
:file:`_sources/{name}`. The default is ``True``.
|
:file:`_sources/{name}`. The default is ``True``.
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
|
||||||
|
If this config value is set to ``False``, the JavaScript search function
|
||||||
|
will only display the titles of matching documents, and no excerpt from
|
||||||
|
the matching contents.
|
||||||
|
|
||||||
.. confval:: html_use_opensearch
|
.. confval:: html_use_opensearch
|
||||||
|
|
||||||
If nonempty, an `OpenSearch <http://opensearch.org>` description file will be
|
If nonempty, an `OpenSearch <http://opensearch.org>` description file will be
|
||||||
|
|||||||
@@ -440,6 +440,7 @@ class StandaloneHTMLBuilder(Builder):
|
|||||||
docstitle = self.config.html_title,
|
docstitle = self.config.html_title,
|
||||||
shorttitle = self.config.html_short_title,
|
shorttitle = self.config.html_short_title,
|
||||||
show_sphinx = self.config.html_show_sphinx,
|
show_sphinx = self.config.html_show_sphinx,
|
||||||
|
has_source = self.config.html_copy_source,
|
||||||
file_suffix = self.out_suffix,
|
file_suffix = self.out_suffix,
|
||||||
script_files = self.script_files,
|
script_files = self.script_files,
|
||||||
sphinx_version = __version__,
|
sphinx_version = __version__,
|
||||||
|
|||||||
@@ -431,7 +431,7 @@ var Search = {
|
|||||||
listItem.slideDown(5, function() {
|
listItem.slideDown(5, function() {
|
||||||
displayNextItem();
|
displayNextItem();
|
||||||
});
|
});
|
||||||
} else {
|
} else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
|
||||||
$.get('_sources/' + item[0] + '.txt', function(data) {
|
$.get('_sources/' + item[0] + '.txt', function(data) {
|
||||||
listItem.append($.makeSearchSummary(data, searchterms, hlterms));
|
listItem.append($.makeSearchSummary(data, searchterms, hlterms));
|
||||||
Search.output.append(listItem);
|
Search.output.append(listItem);
|
||||||
@@ -439,6 +439,12 @@ var Search = {
|
|||||||
displayNextItem();
|
displayNextItem();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// no source available, just display title
|
||||||
|
Search.output.append(listItem);
|
||||||
|
listItem.slideDown(5, function() {
|
||||||
|
displayNextItem();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// search finished, update title and status message
|
// search finished, update title and status message
|
||||||
|
|||||||
@@ -108,7 +108,8 @@
|
|||||||
URL_ROOT: '{{ pathto("", 1) }}',
|
URL_ROOT: '{{ pathto("", 1) }}',
|
||||||
VERSION: '{{ release|e }}',
|
VERSION: '{{ release|e }}',
|
||||||
COLLAPSE_MODINDEX: false,
|
COLLAPSE_MODINDEX: false,
|
||||||
FILE_SUFFIX: '{{ file_suffix }}'
|
FILE_SUFFIX: '{{ file_suffix }}',
|
||||||
|
HAS_SOURCE: {{ has_source|lower }}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
{%- for scriptfile in script_files %}
|
{%- for scriptfile in script_files %}
|
||||||
|
|||||||
Reference in New Issue
Block a user