Comments clean up around the logic of determining which files to scan for sorting specs.

Added yarn.lock to support deterministic build
This commit is contained in:
SebastianMC 2022-12-05 17:37:51 +01:00
parent 4c39f277c0
commit 91859cd0fa
2 changed files with 2954 additions and 6 deletions

View File

@ -80,15 +80,17 @@ export default class CustomSortPlugin extends Plugin {
const aFile: TFile = file as TFile const aFile: TFile = file as TFile
const parent: TFolder = aFile.parent const parent: TFolder = aFile.parent
// Read sorting spec from three sources of equal priority: // Read sorting spec from three sources of equal priority:
// - files with designated name (sortspec.md by default) // - files with designated predefined name
// - 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), e.g.: References/References.md
// - the file explicitly indicated in documentation, by default Inbox/Inbox.md // - the file(s) explicitly configured by user in plugin settings
// Be human-friendly and accept both .md and .md.md file extensions
// (the latter representing a typical confusion between note name vs underlying file name)
if (aFile.name === SORTSPEC_FILE_NAME || if (aFile.name === SORTSPEC_FILE_NAME ||
aFile.name === `${SORTSPEC_FILE_NAME}.md` || 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 ||
aFile.path === this.settings.additionalSortspecFile || // (B) 'Inbox/sort.md' === setting 'Inbox/sort.md' aFile.path === this.settings.additionalSortspecFile ||
aFile.path === `${this.settings.additionalSortspecFile}.md` // (C) 'Inbox/sort.md.md' === setting 'Inbox/sort.md' aFile.path === `${this.settings.additionalSortspecFile}.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) {

2946
yarn.lock Normal file

File diff suppressed because it is too large Load Diff