Skip to content

Commit

Permalink
Custom Tags
Browse files Browse the repository at this point in the history
  • Loading branch information
Sascha Lucius committed Mar 29, 2024
1 parent 94edf89 commit 2090298
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ for (const file of files) {
console.log('bi', bi.length);
const key = reduceStemmed(filterByOccurence(countOccurence(allKeywords), 5));
console.log('key', key.length);
const custom = Array.from(new Set(allCustomTags));
const custom = Array.from(new Set(allCustomTags)).map((tag) => 'CT:' + tag); //mark custom tags
console.log('custom', custom.length);

let all = tri.concat(bi).concat(key).concat(custom);
Expand Down
5 changes: 2 additions & 3 deletions src/lib/components/search/AutocompleteItem.svelte
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
<script lang="ts">
export let itemLabel: string;
export let highlighted: boolean;
$: label = itemLabel.replace(/([a-z])([A-Z])/g, '$1 $2');
$: isTag = itemLabel !== label;
$: isTag = itemLabel.startsWith('CT:');
$: label = isTag ? itemLabel.slice(3).replace(/([a-z])([A-Z])/g, '$1 $2') : itemLabel;
</script>

<!-- svelte-ignore a11y-click-events-have-key-events -->
Expand Down
3 changes: 2 additions & 1 deletion src/lib/components/search/SearchBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
}
function setInputVal(itemName: string) {
$searchTerm = removeBold(itemName);
const term = removeBold(itemName);
$searchTerm = term.startsWith('CT:') ? term.slice(3) : term;
filteredItems = [];
hiLiteIndex = null;
(document?.querySelector('#item-input') as HTMLInputElement).focus();
Expand Down

0 comments on commit 2090298

Please sign in to comment.