feat: Allow sortspec.md.md in addition to sortspec.md files (#38)
This commit is contained in:
parent
84a5238814
commit
4c39f277c0
|
@ -23,6 +23,7 @@
|
||||||
"@typescript-eslint/parser": "5.29.0",
|
"@typescript-eslint/parser": "5.29.0",
|
||||||
"builtin-modules": "3.3.0",
|
"builtin-modules": "3.3.0",
|
||||||
"esbuild": "0.14.47",
|
"esbuild": "0.14.47",
|
||||||
|
"eslint": "^8.29.0",
|
||||||
"jest": "^28.1.1",
|
"jest": "^28.1.1",
|
||||||
"monkey-around": "^2.3.0",
|
"monkey-around": "^2.3.0",
|
||||||
"obsidian": "^0.15.4",
|
"obsidian": "^0.15.4",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import {FrontMatterCache, MetadataCache, requireApiVersion, TAbstractFile, TFile, TFolder} from 'obsidian';
|
import {FrontMatterCache, requireApiVersion, TAbstractFile, TFile, TFolder} from 'obsidian';
|
||||||
import {
|
import {
|
||||||
CustomSortGroup,
|
CustomSortGroup,
|
||||||
CustomSortGroupType,
|
CustomSortGroupType,
|
||||||
|
|
|
@ -84,10 +84,11 @@ export default class CustomSortPlugin extends Plugin {
|
||||||
// - files with the same name as parent folders (aka folder notes): References/References.md
|
// - 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
|
// - the file explicitly indicated in documentation, by default Inbox/Inbox.md
|
||||||
if (aFile.name === SORTSPEC_FILE_NAME ||
|
if (aFile.name === SORTSPEC_FILE_NAME ||
|
||||||
|
aFile.name === `${SORTSPEC_FILE_NAME}.md` ||
|
||||||
aFile.basename === parent.name ||
|
aFile.basename === parent.name ||
|
||||||
aFile.basename === this.settings.additionalSortspecFile || // (A) 'Inbox/sort' === setting 'Inbox/sort'
|
aFile.basename === this.settings.additionalSortspecFile || // (A) 'Inbox/sort' === setting 'Inbox/sort'
|
||||||
aFile.path === this.settings.additionalSortspecFile || // (B) 'Inbox/sort.md' === setting 'Inbox/sort.md'
|
aFile.path === this.settings.additionalSortspecFile || // (B) 'Inbox/sort.md' === setting 'Inbox/sort.md'
|
||||||
aFile.path === this.settings.additionalSortspecFile + '.md' // (C) 'Inbox/sort.md.md' === setting 'Inbox/sort.md'
|
aFile.path === `${this.settings.additionalSortspecFile}.md` // (C) 'Inbox/sort.md.md' === setting 'Inbox/sort.md'
|
||||||
) {
|
) {
|
||||||
const sortingSpecTxt: string = mCache.getCache(aFile.path)?.frontmatter?.[SORTINGSPEC_YAML_KEY]
|
const sortingSpecTxt: string = mCache.getCache(aFile.path)?.frontmatter?.[SORTINGSPEC_YAML_KEY]
|
||||||
if (sortingSpecTxt) {
|
if (sortingSpecTxt) {
|
||||||
|
|
Loading…
Reference in New Issue