vdoc: search fix titles (#7681)

pull/7695/head
Daniel Däschle 2020-12-29 20:01:12 +01:00 committed by GitHub
parent 27db4b4c23
commit 7bd0c5bc03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -125,8 +125,8 @@ function setupSearch() {
var searchIndexLength = searchIndex.length; var searchIndexLength = searchIndex.length;
var results = []; var results = [];
for (var i = 0; i < searchIndexLength; i++) { for (var i = 0; i < searchIndexLength; i++) {
var title = searchIndex[i].toLowerCase(); var title = searchIndex[i];
if (title.indexOf(searchValue) === -1) { if (title.toLowerCase().indexOf(searchValue) === -1) {
continue continue
} }
// [badge, description, link] // [badge, description, link]

View File

@ -743,7 +743,11 @@ fn (mut cfg DocConfig) create_search_results(mod string, dn doc.DocNode) {
dn_description := trim_doc_node_description(dn.comment) dn_description := trim_doc_node_description(dn.comment)
cfg.search_index << dn.name cfg.search_index << dn.name
cfg.search_data << SearchResult{ cfg.search_data << SearchResult{
prefix: '$dn.kind ($dn.parent_name)' prefix: if dn.parent_name != '' {
'$dn.kind ($dn.parent_name)'
} else {
'$dn.kind '
}
description: dn_description description: dn_description
badge: mod badge: mod
link: cfg.get_file_name(mod) + '#' + get_node_id(dn) link: cfg.get_file_name(mod) + '#' + get_node_id(dn)