Skip to content

Commit efea26f

Browse files
authored
Merge pull request #9495 from tk0miya/9456_abbr_marks_on_search_result
Fix #9456: html search: abbreation marks are inserted to the search
2 parents 3fe01c3 + 216e16a commit efea26f

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
@@ -28,6 +28,8 @@ Bugs fixed
2828
* #9481: autosummary: some warnings contain non-existing filenames
2929
* #9481: c domain: some warnings contain non-existing filenames
3030
* #9481: cpp domain: some warnings contain non-existing filenames
31+
* #9456: html search: abbreation marks are inserted to the search result if
32+
failed to fetch the content of the page
3133

3234
Testing
3335
--------

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() {
@@ -498,6 +501,9 @@ var Search = {
498501
*/
499502
makeSearchSummary : function(htmlText, keywords, hlwords) {
500503
var text = Search.htmlToText(htmlText);
504+
if (text == "") {
505+
return null;
506+
}
501507
var textLower = text.toLowerCase();
502508
var start = 0;
503509
$.each(keywords, function() {

0 commit comments

Comments
 (0)