Fix #9456: html search: abbreation marks are inserted to the search

This commit is contained in:
Takeshi KOMIYA
2021-07-24 21:53:57 +09:00
parent 07598f0d6f
commit 175301218d
2 changed files with 9 additions and 1 deletions

View File

@@ -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
--------

View File

@@ -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() {
@@ -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() {