Skip to content

Commit 1753012

Browse files
committed
Fix #9456: html search: abbreation marks are inserted to the search
1 parent 07598f0 commit 1753012

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Bugs fixed
2121
----------
2222

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

2527
Testing
2628
--------

sphinx/themes/basic/static/searchtools.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@ var Search = {
282282
complete: function(jqxhr, textstatus) {
283283
var data = jqxhr.responseText;
284284
if (data !== '' && data !== undefined) {
285-
listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
285+
var summary = Search.makeSearchSummary(data, searchterms, hlterms);
286+
if (summary) {
287+
listItem.append(summary);
288+
}
286289
}
287290
Search.output.append(listItem);
288291
setTimeout(function() {
@@ -492,6 +495,9 @@ var Search = {
492495
*/
493496
makeSearchSummary : function(htmlText, keywords, hlwords) {
494497
var text = Search.htmlToText(htmlText);
498+
if (text == "") {
499+
return null;
500+
}
495501
var textLower = text.toLowerCase();
496502
var start = 0;
497503
$.each(keywords, function() {

0 commit comments

Comments
 (0)