diff --git a/CHANGES b/CHANGES index 5b509d499..7b6465386 100644 --- a/CHANGES +++ b/CHANGES @@ -6,7 +6,7 @@ New features added * Configuration: -- The new ``html_add_permalinks`` config value can be used to + - The new ``html_add_permalinks`` config value can be used to switch off the generated "paragraph sign" permalinks for each heading and definition environment. @@ -24,6 +24,8 @@ New features added 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. ``autoclass_content = "both"`` set. diff --git a/doc/config.rst b/doc/config.rst index c7e07477f..53816cc7a 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -402,6 +402,12 @@ that use Sphinx' HTMLWriter class. If true, the reST sources are included in the HTML build as :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 If nonempty, an `OpenSearch ` description file will be diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index 7592dced7..67b3557de 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -141,6 +141,7 @@ class StandaloneHTMLBuilder(Builder): docstitle = self.config.html_title, shorttitle = self.config.html_short_title, show_sphinx = self.config.html_show_sphinx, + has_source = self.config.html_copy_source, file_suffix = self.out_suffix, script_files = self.script_files, sphinx_version = __version__, diff --git a/sphinx/static/searchtools.js b/sphinx/static/searchtools.js index eb7d62c38..f9d9b6c39 100644 --- a/sphinx/static/searchtools.js +++ b/sphinx/static/searchtools.js @@ -431,7 +431,7 @@ var Search = { listItem.slideDown(5, function() { displayNextItem(); }); - } else { + } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) { $.get('_sources/' + item[0] + '.txt', function(data) { listItem.append($.makeSearchSummary(data, searchterms, hlterms)); Search.output.append(listItem); @@ -439,6 +439,12 @@ var Search = { displayNextItem(); }); }); + } else { + // no source available, just display title + Search.output.append(listItem); + listItem.slideDown(5, function() { + displayNextItem(); + }); } } // search finished, update title and status message diff --git a/sphinx/templates/layout.html b/sphinx/templates/layout.html index 3efb7a8db..d9c9045d3 100644 --- a/sphinx/templates/layout.html +++ b/sphinx/templates/layout.html @@ -105,10 +105,11 @@ {%- if builder != 'htmlhelp' %} {%- for scriptfile in script_files %}