Skip to content

Commit

Permalink
feat(FolderNote): ✨ BC-folder-note-subfolders: true takes notes in …
Browse files Browse the repository at this point in the history
…subfolders of the folderNote and adds those notes, too (#218)
  • Loading branch information
SkepticMystic committed Jan 9, 2022
1 parent ce8e36b commit 0d839ac
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
14 changes: 12 additions & 2 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -21029,8 +21029,9 @@ const blankRealNImplied = () => {
prev: { reals: [], implieds: [] },
};
};
const [BC_FOLDER_NOTE, BC_TAG_NOTE, BC_TAG_NOTE_FIELD, BC_TAG_NOTE_EXACT, BC_LINK_NOTE, BC_TRAVERSE_NOTE, BC_REGEX_NOTE, BC_REGEX_NOTE_FIELD, BC_HIDE_TRAIL, BC_ORDER,] = [
const [BC_FOLDER_NOTE, BC_FOLDER_NOTE_SUBFOLDER, BC_TAG_NOTE, BC_TAG_NOTE_FIELD, BC_TAG_NOTE_EXACT, BC_LINK_NOTE, BC_TRAVERSE_NOTE, BC_REGEX_NOTE, BC_REGEX_NOTE_FIELD, BC_HIDE_TRAIL, BC_ORDER,] = [
"BC-folder-note",
"BC-folder-note-subfolder",
"BC-tag-note",
"BC-tag-note-field",
"BC-tag-note-exact",
Expand All @@ -21048,6 +21049,12 @@ const BC_FIELDS_INFO = [
after: ": ",
alt: true,
},
{
field: BC_FOLDER_NOTE_SUBFOLDER,
desc: "This folder note should take notes in the same folder as it, _and_ notes in subfolders of it.",
after: ": true",
alt: false,
},
{
field: BC_TAG_NOTE,
desc: "Set this note as a Breadcrumbs tag-note. All other notes with this tag will be added to the graph using the default fieldName specified in `Settings > Alternative Hierarchies > Tag Notes > Default Field`, or using the fieldName you specify with `BC-tag-note-field: fieldName`",
Expand Down Expand Up @@ -53442,9 +53449,12 @@ class BCPlugin extends require$$0.Plugin {
const { file } = altFile;
const basename = getDVBasename(file);
const folder = getFolder(file);
const subfolders = altFile[BC_FOLDER_NOTE_SUBFOLDER];
const targets = frontms
.map((ff) => ff.file)
.filter((other) => getFolder(other) === folder && other.path !== file.path)
.filter((other) => (subfolders
? getFolder(other).includes(folder)
: getFolder(other) === folder) && other.path !== file.path)
.map(getDVBasename);
const field = altFile[BC_FOLDER_NOTE];
if (typeof field !== "string" || !fields.includes(field))
Expand Down
8 changes: 8 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export const blankRealNImplied = () => {

export const [
BC_FOLDER_NOTE,
BC_FOLDER_NOTE_SUBFOLDER,
BC_TAG_NOTE,
BC_TAG_NOTE_FIELD,
BC_TAG_NOTE_EXACT,
Expand All @@ -95,6 +96,7 @@ export const [
BC_ORDER,
] = [
"BC-folder-note",
"BC-folder-note-subfolder",
"BC-tag-note",
"BC-tag-note-field",
"BC-tag-note-exact",
Expand All @@ -113,6 +115,12 @@ export const BC_FIELDS_INFO = [
after: ": ",
alt: true,
},
{
field: BC_FOLDER_NOTE_SUBFOLDER,
desc: "This folder note should take notes in the same folder as it, _and_ notes in subfolders of it.",
after: ": true",
alt: false,
},
{
field: BC_TAG_NOTE,
desc: "Set this note as a Breadcrumbs tag-note. All other notes with this tag will be added to the graph using the default fieldName specified in `Settings > Alternative Hierarchies > Tag Notes > Default Field`, or using the fieldName you specify with `BC-tag-note-field: fieldName`",
Expand Down
7 changes: 6 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import TrailPath from "./Components/TrailPath.svelte";
import {
BC_ALTS,
BC_FOLDER_NOTE,
BC_FOLDER_NOTE_SUBFOLDER,
BC_HIDE_TRAIL,
BC_LINK_NOTE,
BC_ORDER,
Expand Down Expand Up @@ -1159,11 +1160,15 @@ export default class BCPlugin extends Plugin {
const { file } = altFile;
const basename = getDVBasename(file);
const folder = getFolder(file);
const subfolders = altFile[BC_FOLDER_NOTE_SUBFOLDER];

const targets = frontms
.map((ff) => ff.file)
.filter(
(other) => getFolder(other) === folder && other.path !== file.path
(other) =>
(subfolders
? getFolder(other).includes(folder)
: getFolder(other) === folder) && other.path !== file.path
)
.map(getDVBasename);

Expand Down

0 comments on commit 0d839ac

Please sign in to comment.