Merge pull request #7194 from tk0miya/search_show_warning

html search: show warning if [role=main] element not found
This commit is contained in:
Takeshi KOMIYA 2020-02-22 14:16:02 +09:00 committed by GitHub
commit 723c4491c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -64,7 +64,9 @@ var Search = {
$(htmlElement).find('.headerlink').remove();
docContent = $(htmlElement).find('[role=main]')[0];
if(docContent === undefined) {
return "";
console.warn("Content block not found. Sphinx search tries to obtain it " +
"via '[role=main]'. Could you check your theme or template.");
return "";
}
return docContent.textContent || docContent.innerText;
},