Skip to content

Commit

Permalink
Merge pull request #9495 from tk0miya/9456_abbr_marks_on_search_result
Browse files Browse the repository at this point in the history
Fix #9456: html search: abbreation marks are inserted to the search
  • Loading branch information
tk0miya committed Aug 1, 2021
2 parents 3fe01c3 + 216e16a commit efea26f
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 @@ -28,6 +28,8 @@ Bugs fixed
* #9481: autosummary: some warnings contain non-existing filenames
* #9481: c 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
--------
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 @@ -498,6 +501,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 efea26f

Please sign in to comment.