mirror of
https://github.com/antokeinanen/obsidian-advanced-merger.git
synced 2026-07-22 07:40:24 +00:00
chore: fromat project
This commit is contained in:
parent
df3599b60f
commit
6fdd93316d
8 changed files with 144 additions and 132 deletions
42
.eslintrc
42
.eslintrc
|
|
@ -1,23 +1,21 @@
|
||||||
{
|
{
|
||||||
"root": true,
|
"root": true,
|
||||||
"parser": "@typescript-eslint/parser",
|
"parser": "@typescript-eslint/parser",
|
||||||
"env": { "node": true },
|
"env": { "node": true },
|
||||||
"plugins": [
|
"plugins": ["@typescript-eslint"],
|
||||||
"@typescript-eslint"
|
"extends": [
|
||||||
],
|
"eslint:recommended",
|
||||||
"extends": [
|
"plugin:@typescript-eslint/eslint-recommended",
|
||||||
"eslint:recommended",
|
"plugin:@typescript-eslint/recommended"
|
||||||
"plugin:@typescript-eslint/eslint-recommended",
|
],
|
||||||
"plugin:@typescript-eslint/recommended"
|
"parserOptions": {
|
||||||
],
|
"sourceType": "module"
|
||||||
"parserOptions": {
|
},
|
||||||
"sourceType": "module"
|
"rules": {
|
||||||
},
|
"no-unused-vars": "off",
|
||||||
"rules": {
|
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
|
||||||
"no-unused-vars": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/no-unused-vars": ["error", { "args": "none" }],
|
"no-prototype-builtins": "off",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/no-empty-function": "off"
|
||||||
"no-prototype-builtins": "off",
|
}
|
||||||
"@typescript-eslint/no-empty-function": "off"
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
13
.github/ISSUE_TEMPLATE/bug_report.md
vendored
13
.github/ISSUE_TEMPLATE/bug_report.md
vendored
|
|
@ -1,10 +1,9 @@
|
||||||
---
|
---
|
||||||
name: Bug report
|
name: Bug report
|
||||||
about: Create a report to help us improve
|
about: Create a report to help us improve
|
||||||
title: ''
|
title: ""
|
||||||
labels: ''
|
labels: ""
|
||||||
assignees: antoKeinanen
|
assignees: antoKeinanen
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Describe the bug**
|
**Describe the bug**
|
||||||
|
|
@ -12,6 +11,7 @@ A clear and concise description of what the bug is.
|
||||||
|
|
||||||
**To Reproduce**
|
**To Reproduce**
|
||||||
Steps to reproduce the behavior:
|
Steps to reproduce the behavior:
|
||||||
|
|
||||||
1. Go to '...'
|
1. Go to '...'
|
||||||
2. Click on '....'
|
2. Click on '....'
|
||||||
3. Scroll down to '....'
|
3. Scroll down to '....'
|
||||||
|
|
@ -24,9 +24,10 @@ A clear and concise description of what you expected to happen.
|
||||||
If applicable, add screenshots to help explain your problem.
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
**System information:**
|
**System information:**
|
||||||
- OS: [e.g. iOS8.1, linux]
|
|
||||||
- Obsidian version [e.g. 1.1.16] *(can be found at about page in settings)*
|
- OS: [e.g. iOS8.1, linux]
|
||||||
- Plugin version [e.g. 1.0.0] *(can be found at community plugins page in settings)*
|
- Obsidian version [e.g. 1.1.16] _(can be found at about page in settings)_
|
||||||
|
- Plugin version [e.g. 1.0.0] _(can be found at community plugins page in settings)_
|
||||||
|
|
||||||
**Additional context**
|
**Additional context**
|
||||||
Add any other context about the problem here.
|
Add any other context about the problem here.
|
||||||
|
|
|
||||||
7
.github/ISSUE_TEMPLATE/feature_request.md
vendored
7
.github/ISSUE_TEMPLATE/feature_request.md
vendored
|
|
@ -1,10 +1,9 @@
|
||||||
---
|
---
|
||||||
name: Feature request
|
name: Feature request
|
||||||
about: Suggest an idea for this project
|
about: Suggest an idea for this project
|
||||||
title: ''
|
title: ""
|
||||||
labels: ''
|
labels: ""
|
||||||
assignees: ''
|
assignees: ""
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Is your feature request related to a problem? Please describe.**
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -23,3 +23,5 @@ data.json
|
||||||
|
|
||||||
# Exclude macOS Finder (System Explorer) View States
|
# Exclude macOS Finder (System Explorer) View States
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
bun.lockb
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
. "$(dirname -- "$0")/_/husky.sh"
|
. "$(dirname -- "$0")/_/husky.sh"
|
||||||
|
|
||||||
npx pretty-quick --staged
|
npx prettier . --write
|
||||||
|
|
|
||||||
124
main.ts
124
main.ts
|
|
@ -35,16 +35,19 @@ const TRANSLATIONS: { [name: string]: Translation } = {
|
||||||
OverwriteFileQuestion: "Vorhandene Datei überschreiben",
|
OverwriteFileQuestion: "Vorhandene Datei überschreiben",
|
||||||
Settings: "Einstellungen",
|
Settings: "Einstellungen",
|
||||||
SettingIncludeNestedFolders: "Verschachtelte Ordner einbeziehen",
|
SettingIncludeNestedFolders: "Verschachtelte Ordner einbeziehen",
|
||||||
SettingIncludeNestedFoldersDescription: "Wenn aktiviert, werden Dateien in verschachtelten Ordnern zusammengeführt. Andernfalls werden nur Dateien im ausgewählten Ordner zusammengeführt (Standardverhalten).",
|
SettingIncludeNestedFoldersDescription:
|
||||||
|
"Wenn aktiviert, werden Dateien in verschachtelten Ordnern zusammengeführt. Andernfalls werden nur Dateien im ausgewählten Ordner zusammengeführt (Standardverhalten).",
|
||||||
SettingIncludeFoldersAsSections: "Ordner als Abschnitte einbeziehen",
|
SettingIncludeFoldersAsSections: "Ordner als Abschnitte einbeziehen",
|
||||||
SettingIncludeFoldersAsSectionsDescription: "Ordner werden als benannte Abschnitte in die Ausgabedatei eingefügt.",
|
SettingIncludeFoldersAsSectionsDescription:
|
||||||
|
"Ordner werden als benannte Abschnitte in die Ausgabedatei eingefügt.",
|
||||||
Yes: "Ja",
|
Yes: "Ja",
|
||||||
No: "Nein",
|
No: "Nein",
|
||||||
SettingSortMode: "Sortiermodus",
|
SettingSortMode: "Sortiermodus",
|
||||||
SettingSortModeDescription: "Wählen Sie den Sortiermodus für das Zusammenführen von Notizen.",
|
SettingSortModeDescription:
|
||||||
|
"Wählen Sie den Sortiermodus für das Zusammenführen von Notizen.",
|
||||||
SettingSortDateCreated: "Erstellungsdatum",
|
SettingSortDateCreated: "Erstellungsdatum",
|
||||||
SettingSortLogical: "Logisch",
|
SettingSortLogical: "Logisch",
|
||||||
SettingSortAlphabetically: "Alphabetisch"
|
SettingSortAlphabetically: "Alphabetisch",
|
||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
MergeFolder: "Merge folder",
|
MergeFolder: "Merge folder",
|
||||||
|
|
@ -52,16 +55,18 @@ const TRANSLATIONS: { [name: string]: Translation } = {
|
||||||
OverwriteFileQuestion: "Overwite exising file",
|
OverwriteFileQuestion: "Overwite exising file",
|
||||||
Settings: "Settings",
|
Settings: "Settings",
|
||||||
SettingIncludeNestedFolders: "Include nested folders",
|
SettingIncludeNestedFolders: "Include nested folders",
|
||||||
SettingIncludeNestedFoldersDescription: "If enabled, files in nested folders will be included in merge. Otherwise, only files in selected folder will be merged (default behaviour).",
|
SettingIncludeNestedFoldersDescription:
|
||||||
|
"If enabled, files in nested folders will be included in merge. Otherwise, only files in selected folder will be merged (default behaviour).",
|
||||||
SettingIncludeFoldersAsSections: "Include folders as sections",
|
SettingIncludeFoldersAsSections: "Include folders as sections",
|
||||||
SettingIncludeFoldersAsSectionsDescription: "Folders will be included as named sections into output file.",
|
SettingIncludeFoldersAsSectionsDescription:
|
||||||
|
"Folders will be included as named sections into output file.",
|
||||||
Yes: "Yes",
|
Yes: "Yes",
|
||||||
No: "No",
|
No: "No",
|
||||||
SettingSortMode: "Sort mode",
|
SettingSortMode: "Sort mode",
|
||||||
SettingSortModeDescription: "Pick the sorting mode for merging notes.",
|
SettingSortModeDescription: "Pick the sorting mode for merging notes.",
|
||||||
SettingSortDateCreated: "Date created",
|
SettingSortDateCreated: "Date created",
|
||||||
SettingSortLogical: "Logical",
|
SettingSortLogical: "Logical",
|
||||||
SettingSortAlphabetically: "Alphabetical"
|
SettingSortAlphabetically: "Alphabetical",
|
||||||
},
|
},
|
||||||
fi: {
|
fi: {
|
||||||
MergeFolder: "Yhdistä kansio",
|
MergeFolder: "Yhdistä kansio",
|
||||||
|
|
@ -69,16 +74,19 @@ const TRANSLATIONS: { [name: string]: Translation } = {
|
||||||
OverwriteFileQuestion: "Korvaa olemassa oleva tiedosto",
|
OverwriteFileQuestion: "Korvaa olemassa oleva tiedosto",
|
||||||
Settings: "Asetukset",
|
Settings: "Asetukset",
|
||||||
SettingIncludeNestedFolders: "Sisällytä sisäkkäiset kansiot",
|
SettingIncludeNestedFolders: "Sisällytä sisäkkäiset kansiot",
|
||||||
SettingIncludeNestedFoldersDescription: "Jos käytössä, sisäkkäisten kansioiden tiedostot yhdistetään. Muussa tapauksessa vain valitun kansion tiedostot yhdistetään (oletustoiminto).",
|
SettingIncludeNestedFoldersDescription:
|
||||||
|
"Jos käytössä, sisäkkäisten kansioiden tiedostot yhdistetään. Muussa tapauksessa vain valitun kansion tiedostot yhdistetään (oletustoiminto).",
|
||||||
SettingIncludeFoldersAsSections: "Sisällytä kansiot osioihin",
|
SettingIncludeFoldersAsSections: "Sisällytä kansiot osioihin",
|
||||||
SettingIncludeFoldersAsSectionsDescription: "Kansiot sisällytetään nimettyinä osina tulostiedostoon.",
|
SettingIncludeFoldersAsSectionsDescription:
|
||||||
|
"Kansiot sisällytetään nimettyinä osina tulostiedostoon.",
|
||||||
Yes: "Kyllä",
|
Yes: "Kyllä",
|
||||||
No: "Ei",
|
No: "Ei",
|
||||||
SettingSortMode: "Lajittelu järjestys",
|
SettingSortMode: "Lajittelu järjestys",
|
||||||
SettingSortModeDescription: "Valitse lajittelutapa muistiinpanojen yhdistämistä varten.",
|
SettingSortModeDescription:
|
||||||
|
"Valitse lajittelutapa muistiinpanojen yhdistämistä varten.",
|
||||||
SettingSortDateCreated: "Luontipäivämäärä",
|
SettingSortDateCreated: "Luontipäivämäärä",
|
||||||
SettingSortLogical: "Looginen",
|
SettingSortLogical: "Looginen",
|
||||||
SettingSortAlphabetically: "Aakkosjärjestys"
|
SettingSortAlphabetically: "Aakkosjärjestys",
|
||||||
},
|
},
|
||||||
fr: {
|
fr: {
|
||||||
MergeFolder: "Fusionner le dossier",
|
MergeFolder: "Fusionner le dossier",
|
||||||
|
|
@ -86,16 +94,20 @@ const TRANSLATIONS: { [name: string]: Translation } = {
|
||||||
OverwriteFileQuestion: "Remplacer le fichier existant",
|
OverwriteFileQuestion: "Remplacer le fichier existant",
|
||||||
Settings: "Paramètres",
|
Settings: "Paramètres",
|
||||||
SettingIncludeNestedFolders: "Inclure les dossiers imbriqués",
|
SettingIncludeNestedFolders: "Inclure les dossiers imbriqués",
|
||||||
SettingIncludeNestedFoldersDescription: "Si activé, les fichiers des dossiers imbriqués seront inclus dans la fusion. Sinon, seuls les fichiers du dossier sélectionné seront fusionnés (comportement par défaut).",
|
SettingIncludeNestedFoldersDescription:
|
||||||
SettingIncludeFoldersAsSections: "Inclure les dossiers en tant que sections",
|
"Si activé, les fichiers des dossiers imbriqués seront inclus dans la fusion. Sinon, seuls les fichiers du dossier sélectionné seront fusionnés (comportement par défaut).",
|
||||||
SettingIncludeFoldersAsSectionsDescription: "Les dossiers seront inclus en tant que sections nommées dans le fichier de sortie.",
|
SettingIncludeFoldersAsSections:
|
||||||
|
"Inclure les dossiers en tant que sections",
|
||||||
|
SettingIncludeFoldersAsSectionsDescription:
|
||||||
|
"Les dossiers seront inclus en tant que sections nommées dans le fichier de sortie.",
|
||||||
Yes: "Oui",
|
Yes: "Oui",
|
||||||
No: "Non",
|
No: "Non",
|
||||||
SettingSortMode: "mode de tri",
|
SettingSortMode: "mode de tri",
|
||||||
SettingSortModeDescription: "Choisissez le mode de tri pour la fusion des notes.",
|
SettingSortModeDescription:
|
||||||
|
"Choisissez le mode de tri pour la fusion des notes.",
|
||||||
SettingSortDateCreated: "Date de création",
|
SettingSortDateCreated: "Date de création",
|
||||||
SettingSortLogical: "Logique",
|
SettingSortLogical: "Logique",
|
||||||
SettingSortAlphabetically: "Alphabétique"
|
SettingSortAlphabetically: "Alphabétique",
|
||||||
},
|
},
|
||||||
ru: {
|
ru: {
|
||||||
MergeFolder: "Объединить папку",
|
MergeFolder: "Объединить папку",
|
||||||
|
|
@ -103,16 +115,19 @@ const TRANSLATIONS: { [name: string]: Translation } = {
|
||||||
OverwriteFileQuestion: "Перезаписать существующий файл",
|
OverwriteFileQuestion: "Перезаписать существующий файл",
|
||||||
Settings: "Настройки",
|
Settings: "Настройки",
|
||||||
SettingIncludeNestedFolders: "Влючать вложенные папки",
|
SettingIncludeNestedFolders: "Влючать вложенные папки",
|
||||||
SettingIncludeNestedFoldersDescription: "Если включено, файлы во вложенных папках будут включены в слияние. В противном случае будут объединены только файлы в выбранной папке (поведение по умолчанию).",
|
SettingIncludeNestedFoldersDescription:
|
||||||
|
"Если включено, файлы во вложенных папках будут включены в слияние. В противном случае будут объединены только файлы в выбранной папке (поведение по умолчанию).",
|
||||||
SettingIncludeFoldersAsSections: "Включать папки как разделы",
|
SettingIncludeFoldersAsSections: "Включать папки как разделы",
|
||||||
SettingIncludeFoldersAsSectionsDescription: "Папки будут включены в выходной файл в качестве разделов.",
|
SettingIncludeFoldersAsSectionsDescription:
|
||||||
|
"Папки будут включены в выходной файл в качестве разделов.",
|
||||||
Yes: "Да",
|
Yes: "Да",
|
||||||
No: "Нет",
|
No: "Нет",
|
||||||
SettingSortMode: "режим сортировки",
|
SettingSortMode: "режим сортировки",
|
||||||
SettingSortModeDescription: "Выберите режим сортировки при объединении заметок.",
|
SettingSortModeDescription:
|
||||||
|
"Выберите режим сортировки при объединении заметок.",
|
||||||
SettingSortDateCreated: "Дата создания",
|
SettingSortDateCreated: "Дата создания",
|
||||||
SettingSortLogical: "Логический",
|
SettingSortLogical: "Логический",
|
||||||
SettingSortAlphabetically: "Алфавитный указатель"
|
SettingSortAlphabetically: "Алфавитный указатель",
|
||||||
},
|
},
|
||||||
ua: {
|
ua: {
|
||||||
MergeFolder: "Об'єднати папку",
|
MergeFolder: "Об'єднати папку",
|
||||||
|
|
@ -120,16 +135,19 @@ const TRANSLATIONS: { [name: string]: Translation } = {
|
||||||
OverwriteFileQuestion: "Перезаписати існуючий файл",
|
OverwriteFileQuestion: "Перезаписати існуючий файл",
|
||||||
Settings: "Налаштування",
|
Settings: "Налаштування",
|
||||||
SettingIncludeNestedFolders: "Включити вкладені папки",
|
SettingIncludeNestedFolders: "Включити вкладені папки",
|
||||||
SettingIncludeNestedFoldersDescription: "Якщо ввімкнено, файли у вкладених папках будуть включені в об’єднання. В іншому випадку буде об’єднано лише файли у вибраній папці (поведінка за замовчуванням).",
|
SettingIncludeNestedFoldersDescription:
|
||||||
|
"Якщо ввімкнено, файли у вкладених папках будуть включені в об’єднання. В іншому випадку буде об’єднано лише файли у вибраній папці (поведінка за замовчуванням).",
|
||||||
SettingIncludeFoldersAsSections: "Включити папки як розділи",
|
SettingIncludeFoldersAsSections: "Включити папки як розділи",
|
||||||
SettingIncludeFoldersAsSectionsDescription: "Папки будуть включені як іменовані розділи у вихідний файл.",
|
SettingIncludeFoldersAsSectionsDescription:
|
||||||
|
"Папки будуть включені як іменовані розділи у вихідний файл.",
|
||||||
Yes: "Так",
|
Yes: "Так",
|
||||||
No: "Ні",
|
No: "Ні",
|
||||||
SettingSortMode: "Логический",
|
SettingSortMode: "Логический",
|
||||||
SettingSortModeDescription: "Виберіть режим сортування для об'єднання нотаток.",
|
SettingSortModeDescription:
|
||||||
|
"Виберіть режим сортування для об'єднання нотаток.",
|
||||||
SettingSortDateCreated: "Дата створення",
|
SettingSortDateCreated: "Дата створення",
|
||||||
SettingSortLogical: "Логічний",
|
SettingSortLogical: "Логічний",
|
||||||
SettingSortAlphabetically: "За алфавітом"
|
SettingSortAlphabetically: "За алфавітом",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -216,10 +234,10 @@ export default class AdvancedMerge extends Plugin {
|
||||||
.setIcon(ICON_NAME)
|
.setIcon(ICON_NAME)
|
||||||
.onClick(
|
.onClick(
|
||||||
async (evt) =>
|
async (evt) =>
|
||||||
await this.onClickCallback(folder, evt)
|
await this.onClickCallback(folder, evt),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
// This adds a settings tab so the user can configure various aspects of the plugin
|
// This adds a settings tab so the user can configure various aspects of the plugin
|
||||||
|
|
@ -228,7 +246,7 @@ export default class AdvancedMerge extends Plugin {
|
||||||
|
|
||||||
private async onClickCallback(
|
private async onClickCallback(
|
||||||
folder: TFolder,
|
folder: TFolder,
|
||||||
_evt: MouseEvent | KeyboardEvent
|
_evt: MouseEvent | KeyboardEvent,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const { vault } = this.app;
|
const { vault } = this.app;
|
||||||
|
|
||||||
|
|
@ -251,7 +269,7 @@ export default class AdvancedMerge extends Plugin {
|
||||||
});
|
});
|
||||||
|
|
||||||
const entries = this.sortNotes(
|
const entries = this.sortNotes(
|
||||||
documentEntries.filter((entry) => this.filterNotes(folder, entry))
|
documentEntries.filter((entry) => this.filterNotes(folder, entry)),
|
||||||
);
|
);
|
||||||
|
|
||||||
const outputFileName = `${folder.path}-${
|
const outputFileName = `${folder.path}-${
|
||||||
|
|
@ -266,18 +284,18 @@ export default class AdvancedMerge extends Plugin {
|
||||||
async (deleteFile) => {
|
async (deleteFile) => {
|
||||||
if (!deleteFile) {
|
if (!deleteFile) {
|
||||||
console.info(
|
console.info(
|
||||||
`file "${outputFileName}" already exists, but user cancelled deleting..`
|
`file "${outputFileName}" already exists, but user cancelled deleting..`,
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.info(
|
console.info(
|
||||||
`file "${outputFileName}" already exists, deleting..`
|
`file "${outputFileName}" already exists, deleting..`,
|
||||||
);
|
);
|
||||||
await vault.adapter.remove(outputFileName);
|
await vault.adapter.remove(outputFileName);
|
||||||
|
|
||||||
await this.mergeNotes(vault, entries, outputFileName);
|
await this.mergeNotes(vault, entries, outputFileName);
|
||||||
}
|
},
|
||||||
).open();
|
).open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -293,7 +311,7 @@ export default class AdvancedMerge extends Plugin {
|
||||||
private async mergeNotes(
|
private async mergeNotes(
|
||||||
vault: Vault,
|
vault: Vault,
|
||||||
entries: Array<TAbstractFile>,
|
entries: Array<TAbstractFile>,
|
||||||
outputFileName: string
|
outputFileName: string,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const outputFile = await vault.create(outputFileName, "");
|
const outputFile = await vault.create(outputFileName, "");
|
||||||
|
|
||||||
|
|
@ -309,19 +327,19 @@ export default class AdvancedMerge extends Plugin {
|
||||||
const fileSectionName = folderOrFile.name.replace(/\.md$/, "");
|
const fileSectionName = folderOrFile.name.replace(/\.md$/, "");
|
||||||
// For the first file in a row, we shouldnt add new line
|
// For the first file in a row, we shouldnt add new line
|
||||||
sectionContents = `${SECTION_CHAR.repeat(
|
sectionContents = `${SECTION_CHAR.repeat(
|
||||||
sectionLevel
|
sectionLevel,
|
||||||
)} ${fileSectionName}${DOUBLE_NEW_LINE_CHAR}${sectionContents}${
|
)} ${fileSectionName}${DOUBLE_NEW_LINE_CHAR}${sectionContents}${
|
||||||
lastEntry ? "" : DOUBLE_NEW_LINE_CHAR
|
lastEntry ? "" : DOUBLE_NEW_LINE_CHAR
|
||||||
}`;
|
}`;
|
||||||
console.info(
|
console.info(
|
||||||
`Adding file "${folderOrFile.name}" as section "${fileSectionName}" into file "${outputFileName}"..`
|
`Adding file "${folderOrFile.name}" as section "${fileSectionName}" into file "${outputFileName}"..`,
|
||||||
);
|
);
|
||||||
} else if (folderOrFile instanceof TFolder) {
|
} else if (folderOrFile instanceof TFolder) {
|
||||||
sectionContents += `${SECTION_CHAR.repeat(sectionLevel)} ${
|
sectionContents += `${SECTION_CHAR.repeat(sectionLevel)} ${
|
||||||
folderOrFile.name
|
folderOrFile.name
|
||||||
}${DOUBLE_NEW_LINE_CHAR}`;
|
}${DOUBLE_NEW_LINE_CHAR}`;
|
||||||
console.info(
|
console.info(
|
||||||
`Adding folder "${folderOrFile.name}" as section "${sectionContents}" into file "${outputFileName}"..`
|
`Adding folder "${folderOrFile.name}" as section "${sectionContents}" into file "${outputFileName}"..`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
vault.append(outputFile, sectionContents);
|
vault.append(outputFile, sectionContents);
|
||||||
|
|
@ -353,7 +371,7 @@ export default class AdvancedMerge extends Plugin {
|
||||||
numeric: true,
|
numeric: true,
|
||||||
sensitivity: "base",
|
sensitivity: "base",
|
||||||
usage: "sort",
|
usage: "sort",
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
case SortOptions.CreationDate:
|
case SortOptions.CreationDate:
|
||||||
return files.sort((a, b) => a.stat.ctime - b.stat.ctime);
|
return files.sort((a, b) => a.stat.ctime - b.stat.ctime);
|
||||||
|
|
@ -370,7 +388,7 @@ export default class AdvancedMerge extends Plugin {
|
||||||
this.settings = Object.assign(
|
this.settings = Object.assign(
|
||||||
{},
|
{},
|
||||||
DEFAULT_SETTINGS,
|
DEFAULT_SETTINGS,
|
||||||
await this.loadData()
|
await this.loadData(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -409,16 +427,16 @@ class AdvancedMergeSettingTab extends PluginSettingTab {
|
||||||
// Add "sort mode" dropdown in settings
|
// Add "sort mode" dropdown in settings
|
||||||
new Setting(containerEl)
|
new Setting(containerEl)
|
||||||
.setName(this.plugin.translation.get().SettingSortMode)
|
.setName(this.plugin.translation.get().SettingSortMode)
|
||||||
.setDesc(
|
.setDesc(this.plugin.translation.get().SettingSortModeDescription)
|
||||||
this.plugin.translation.get()
|
|
||||||
.SettingSortModeDescription
|
|
||||||
)
|
|
||||||
.addDropdown((dropdown) =>
|
.addDropdown((dropdown) =>
|
||||||
dropdown.addOptions({
|
dropdown.addOptions({
|
||||||
[SortOptions.Alphabetically]: this.plugin.translation.get().SettingSortAlphabetically,
|
[SortOptions.Alphabetically]:
|
||||||
[SortOptions.CreationDate]: this.plugin.translation.get().SettingSortDateCreated,
|
this.plugin.translation.get().SettingSortAlphabetically,
|
||||||
[SortOptions.Logical]: this.plugin.translation.get().SettingSortLogical,
|
[SortOptions.CreationDate]:
|
||||||
})
|
this.plugin.translation.get().SettingSortDateCreated,
|
||||||
|
[SortOptions.Logical]:
|
||||||
|
this.plugin.translation.get().SettingSortLogical,
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add "include nested folders" toggle in settings
|
// Add "include nested folders" toggle in settings
|
||||||
|
|
@ -426,7 +444,7 @@ class AdvancedMergeSettingTab extends PluginSettingTab {
|
||||||
.setName(this.plugin.translation.get().SettingIncludeNestedFolders)
|
.setName(this.plugin.translation.get().SettingIncludeNestedFolders)
|
||||||
.setDesc(
|
.setDesc(
|
||||||
this.plugin.translation.get()
|
this.plugin.translation.get()
|
||||||
.SettingIncludeNestedFoldersDescription
|
.SettingIncludeNestedFoldersDescription,
|
||||||
)
|
)
|
||||||
.addToggle((toggle) =>
|
.addToggle((toggle) =>
|
||||||
toggle
|
toggle
|
||||||
|
|
@ -439,7 +457,7 @@ class AdvancedMergeSettingTab extends PluginSettingTab {
|
||||||
: this.plugin.settings.includeFoldersAsSections;
|
: this.plugin.settings.includeFoldersAsSections;
|
||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
this.showIncludeFolderAsSectionSetting(containerEl);
|
this.showIncludeFolderAsSectionSetting(containerEl);
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
this.showIncludeFolderAsSectionSetting(containerEl);
|
this.showIncludeFolderAsSectionSetting(containerEl);
|
||||||
|
|
@ -454,11 +472,11 @@ class AdvancedMergeSettingTab extends PluginSettingTab {
|
||||||
// Add "include folders as sections" toggle in settings
|
// Add "include folders as sections" toggle in settings
|
||||||
this.includeFolderAsSectionSetting = new Setting(containerEl)
|
this.includeFolderAsSectionSetting = new Setting(containerEl)
|
||||||
.setName(
|
.setName(
|
||||||
this.plugin.translation.get().SettingIncludeFoldersAsSections
|
this.plugin.translation.get().SettingIncludeFoldersAsSections,
|
||||||
)
|
)
|
||||||
.setDesc(
|
.setDesc(
|
||||||
this.plugin.translation.get()
|
this.plugin.translation.get()
|
||||||
.SettingIncludeFoldersAsSectionsDescription
|
.SettingIncludeFoldersAsSectionsDescription,
|
||||||
)
|
)
|
||||||
.addToggle((toggle) =>
|
.addToggle((toggle) =>
|
||||||
toggle
|
toggle
|
||||||
|
|
@ -466,7 +484,7 @@ class AdvancedMergeSettingTab extends PluginSettingTab {
|
||||||
.onChange(async (value) => {
|
.onChange(async (value) => {
|
||||||
this.plugin.settings.includeFoldersAsSections = value;
|
this.plugin.settings.includeFoldersAsSections = value;
|
||||||
await this.plugin.saveSettings();
|
await this.plugin.saveSettings();
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -488,7 +506,7 @@ class AdvancedMergeOverwriteFileModal extends Modal {
|
||||||
app: App,
|
app: App,
|
||||||
translation: AdvancedMergeTranslation,
|
translation: AdvancedMergeTranslation,
|
||||||
existingFileName: string,
|
existingFileName: string,
|
||||||
handler: (result: boolean) => void
|
handler: (result: boolean) => void,
|
||||||
) {
|
) {
|
||||||
super(app);
|
super(app);
|
||||||
this.tranlation = translation;
|
this.tranlation = translation;
|
||||||
|
|
@ -516,7 +534,7 @@ class AdvancedMergeOverwriteFileModal extends Modal {
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
this.close();
|
this.close();
|
||||||
this.onSubmitHandler(false);
|
this.onSubmitHandler(false);
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
.addButton((btn) =>
|
.addButton((btn) =>
|
||||||
btn
|
btn
|
||||||
|
|
@ -525,7 +543,7 @@ class AdvancedMergeOverwriteFileModal extends Modal {
|
||||||
.onClick(() => {
|
.onClick(() => {
|
||||||
this.close();
|
this.close();
|
||||||
this.onSubmitHandler(true);
|
this.onSubmitHandler(true);
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
49
package.json
49
package.json
|
|
@ -1,34 +1,11 @@
|
||||||
{
|
{
|
||||||
"name": "obsidian-advanced-merger",
|
"name": "obsidian-advanced-merger",
|
||||||
"version": "1.4.0",
|
"version": "1.4.0",
|
||||||
"description": "Merge a folder of notes for easier export. This plugin is designed for Obsidian (https://obsidian.md).",
|
|
||||||
"homepage": "https://github.com/antoKeinanen/obsidian-advanced-merger",
|
|
||||||
"contributors": [
|
|
||||||
{
|
|
||||||
"name": "Dmitry Besedin",
|
|
||||||
"email": "endarvaluk@gmail.com",
|
|
||||||
"url": "https://github.com/EndarValuk/"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"funding": [
|
|
||||||
{
|
|
||||||
"type": "individual",
|
|
||||||
"url": "https://www.buymeacoffee.com/antokeinanen"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"main": "main.js",
|
|
||||||
"scripts": {
|
|
||||||
"dev": "node esbuild.config.mjs",
|
|
||||||
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
|
|
||||||
"version": "node version-bump.mjs && git add manifest.json versions.json",
|
|
||||||
"prepare": "husky install"
|
|
||||||
},
|
|
||||||
"keywords": [],
|
|
||||||
"author": {
|
"author": {
|
||||||
"name": "Anto Keinänen",
|
"name": "Anto Keinänen",
|
||||||
"url": "https://github.com/antoKeinanen/"
|
"url": "https://github.com/antoKeinanen/"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"main": "main.js",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^16.11.6",
|
"@types/node": "^16.11.6",
|
||||||
"@typescript-eslint/eslint-plugin": "5.29.0",
|
"@typescript-eslint/eslint-plugin": "5.29.0",
|
||||||
|
|
@ -37,8 +14,32 @@
|
||||||
"esbuild": "0.17.3",
|
"esbuild": "0.17.3",
|
||||||
"husky": "^8.0.0",
|
"husky": "^8.0.0",
|
||||||
"obsidian": "latest",
|
"obsidian": "latest",
|
||||||
|
"prettier": "^3.0.3",
|
||||||
"pretty-quick": "^3.1.3",
|
"pretty-quick": "^3.1.3",
|
||||||
"tslib": "2.4.0",
|
"tslib": "2.4.0",
|
||||||
"typescript": "4.7.4"
|
"typescript": "4.7.4"
|
||||||
|
},
|
||||||
|
"contributors": [
|
||||||
|
{
|
||||||
|
"name": "Dmitry Besedin",
|
||||||
|
"email": "endarvaluk@gmail.com",
|
||||||
|
"url": "https://github.com/EndarValuk/"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Merge a folder of notes for easier export. This plugin is designed for Obsidian (https://obsidian.md).",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "individual",
|
||||||
|
"url": "https://www.buymeacoffee.com/antokeinanen"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/antoKeinanen/obsidian-advanced-merger",
|
||||||
|
"keywords": [],
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "node esbuild.config.mjs",
|
||||||
|
"build": "tsc -noEmit -skipLibCheck && node esbuild.config.mjs production",
|
||||||
|
"version": "node version-bump.mjs && git add manifest.json versions.json",
|
||||||
|
"prepare": "husky install"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,17 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"inlineSourceMap": true,
|
"inlineSourceMap": true,
|
||||||
"inlineSources": true,
|
"inlineSources": true,
|
||||||
"module": "ESNext",
|
"module": "ESNext",
|
||||||
"target": "ES6",
|
"target": "ES6",
|
||||||
"allowJs": true,
|
"allowJs": true,
|
||||||
"noImplicitAny": true,
|
"noImplicitAny": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"lib": [
|
"lib": ["DOM", "ES5", "ES6", "ES7"]
|
||||||
"DOM",
|
},
|
||||||
"ES5",
|
"include": ["**/*.ts"]
|
||||||
"ES6",
|
|
||||||
"ES7"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"**/*.ts"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue