Skip to content

Commit

Permalink
Fix #9456: html search: abbreation marks are inserted to the search
Browse files Browse the repository at this point in the history
  • Loading branch information
tk0miya committed Jul 24, 2021
1 parent 07598f0 commit 1753012
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES
Expand Up @@ -21,6 +21,8 @@ Bugs fixed
----------

* #9487: autodoc: typehint for cached_property is not shown
* #9456: html search: abbreation marks are inserted to the search result if
failed to fetch the content of the page

Testing
--------
Expand Down
8 changes: 7 additions & 1 deletion sphinx/themes/basic/static/searchtools.js
Expand Up @@ -282,7 +282,10 @@ var Search = {
complete: function(jqxhr, textstatus) {
var data = jqxhr.responseText;
if (data !== '' && data !== undefined) {
listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
var summary = Search.makeSearchSummary(data, searchterms, hlterms);
if (summary) {
listItem.append(summary);
}
}
Search.output.append(listItem);
setTimeout(function() {
Expand Down Expand Up @@ -492,6 +495,9 @@ var Search = {
*/
makeSearchSummary : function(htmlText, keywords, hlwords) {
var text = Search.htmlToText(htmlText);
if (text == "") {
return null;
}
var textLower = text.toLowerCase();
var start = 0;
$.each(keywords, function() {
Expand Down

0 comments on commit 1753012

Please sign in to comment.