From 7bd0c5bc03f47983100aef84de5753cd24093bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=C3=A4schle?= Date: Tue, 29 Dec 2020 20:01:12 +0100 Subject: [PATCH] vdoc: search fix titles (#7681) --- cmd/tools/vdoc/resources/doc.js | 4 ++-- cmd/tools/vdoc/vdoc.v | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/cmd/tools/vdoc/resources/doc.js b/cmd/tools/vdoc/resources/doc.js index ac19dd2978..c69e0df46d 100644 --- a/cmd/tools/vdoc/resources/doc.js +++ b/cmd/tools/vdoc/resources/doc.js @@ -125,8 +125,8 @@ function setupSearch() { var searchIndexLength = searchIndex.length; var results = []; for (var i = 0; i < searchIndexLength; i++) { - var title = searchIndex[i].toLowerCase(); - if (title.indexOf(searchValue) === -1) { + var title = searchIndex[i]; + if (title.toLowerCase().indexOf(searchValue) === -1) { continue } // [badge, description, link] diff --git a/cmd/tools/vdoc/vdoc.v b/cmd/tools/vdoc/vdoc.v index 32983f848b..5fccfeb2e4 100644 --- a/cmd/tools/vdoc/vdoc.v +++ b/cmd/tools/vdoc/vdoc.v @@ -743,7 +743,11 @@ fn (mut cfg DocConfig) create_search_results(mod string, dn doc.DocNode) { dn_description := trim_doc_node_description(dn.comment) cfg.search_index << dn.name 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 badge: mod link: cfg.get_file_name(mod) + '#' + get_node_id(dn)