Merge pull request #9495 from tk0miya/9456_abbr_marks_on_search_result

Fix #9456: html search: abbreation marks are inserted to the search
This commit is contained in:
Takeshi KOMIYA 2021-08-02 01:35:35 +09:00 committed by GitHub
commit efea26f7d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -28,6 +28,8 @@ Bugs fixed
* #9481: autosummary: some warnings contain non-existing filenames * #9481: autosummary: some warnings contain non-existing filenames
* #9481: c domain: some warnings contain non-existing filenames * #9481: c domain: some warnings contain non-existing filenames
* #9481: cpp domain: some warnings contain non-existing filenames * #9481: cpp domain: some warnings contain non-existing filenames
* #9456: html search: abbreation marks are inserted to the search result if
failed to fetch the content of the page
Testing Testing
-------- --------

View File

@ -282,7 +282,10 @@ var Search = {
complete: function(jqxhr, textstatus) { complete: function(jqxhr, textstatus) {
var data = jqxhr.responseText; var data = jqxhr.responseText;
if (data !== '' && data !== undefined) { 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); Search.output.append(listItem);
setTimeout(function() { setTimeout(function() {
@ -498,6 +501,9 @@ var Search = {
*/ */
makeSearchSummary : function(htmlText, keywords, hlwords) { makeSearchSummary : function(htmlText, keywords, hlwords) {
var text = Search.htmlToText(htmlText); var text = Search.htmlToText(htmlText);
if (text == "") {
return null;
}
var textLower = text.toLowerCase(); var textLower = text.toLowerCase();
var start = 0; var start = 0;
$.each(keywords, function() { $.each(keywords, function() {