From 426eb789da3ad1796b106868ad46d305266ced80 Mon Sep 17 00:00:00 2001 From: SebastianMC Date: Thu, 13 Oct 2022 09:10:40 +0200 Subject: [PATCH] 19 - Less confusing description and handling of the `designated note` settings - the path to note entered in setting is treated as (all at once): - path to the note file, OR - path to the note, OR - name of the note --- src/main.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main.ts b/src/main.ts index b300e64..8384041 100644 --- a/src/main.ts +++ b/src/main.ts @@ -82,7 +82,12 @@ export default class CustomSortPlugin extends Plugin { // - files with designated name (sortspec.md by default) // - files with the same name as parent folders (aka folder notes): References/References.md // - the file explicitly indicated in documentation, by default Inbox/Inbox.md - if (aFile.name === SORTSPEC_FILE_NAME || aFile.basename === parent.name || aFile.path === this.settings.additionalSortspecFile) { + if (aFile.name === SORTSPEC_FILE_NAME || + aFile.basename === parent.name || + aFile.basename === this.settings.additionalSortspecFile || + aFile.path === this.settings.additionalSortspecFile || + aFile.path === this.settings.additionalSortspecFile + '.md' + ) { const sortingSpecTxt: string = mCache.getCache(aFile.path)?.frontmatter?.[SORTINGSPEC_YAML_KEY] if (sortingSpecTxt) { anySortingSpecFound = true @@ -328,9 +333,9 @@ class CustomSortSettingTab extends PluginSettingTab { new Setting(containerEl) .setName('Path to the designated note containing sorting specification') - .setDesc('The YAML front matter of this note will be scanned for sorting specification, in addition to the sortspec.md notes and folder notes. Remember to add the `.md` explicitly here.') + .setDesc('The YAML front matter of this note will be scanned for sorting specification, in addition to the `sortspec` notes and folder notes. The `.md` filename suffix is optional.') .addText(text => text - .setPlaceholder('e.g. Inbox/Inbox.md') + .setPlaceholder('e.g. Inbox/sort') .setValue(this.plugin.settings.additionalSortspecFile) .onChange(async (value) => { this.plugin.settings.additionalSortspecFile = value.trim() ? normalizePath(value) : '';