From 76a1b1c290af8cc257568267f41b22b095c748b4 Mon Sep 17 00:00:00 2001 From: xpgo Date: Fri, 19 Feb 2021 19:43:13 +0800 Subject: [PATCH] add keyword folder_path for initial content --- README.md | 3 +++ manifest.json | 2 +- src/folder-note.ts | 6 ++++-- versions.json | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e378a8f..9ab545b 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ When CTRL+Click a folder, the plugin will create a description note with the pat - **Index File Name**: For the *Index-File* method, set the folder note name, like `_overview_` or `index`. (Do not use {{FOLDER_NAME}} any more) - **Note Initial Content**: set the initial content for a new folder note. - {{FOLDER_NAME}} in the content will be replaced with the folder name. + - {{FOLDER_PATH}} in the content will be replaced with the folder path. - {{FOLDER_BRIEF}} in the content will be replaced with a card-style overview of current folder. - {{FOLDER_BRIEF_LIVE}} in the content will be replaced with a tiny code block which will be rendered to the folder overview in real time. - **Key for New Note**: set to use CTRL+Click or ALT+Click for creating new folder note. @@ -79,6 +80,8 @@ Remember to update the plugin, if you find some issues. ### 0.7.x +- add Keyword {{FOLDER_PATH}} for inital content (0.7.1) +- fix multiple usage of some keywords for initial content (0.7.1) - add imagePrefix key for ccard (0.7.0) - add noteOnly Key for folder_brief_live (0.7.0) - fix showing both folder and note for outside mode (0.7.0) diff --git a/manifest.json b/manifest.json index c52450c..3496b73 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "folder-note-plugin", "name": "Folder Note", - "version": "0.7.0", + "version": "0.7.1", "minAppVersion": "0.9.12", "description": "Click a folder node to show a note describing the folder.", "author": "xpgo", diff --git a/src/folder-note.ts b/src/folder-note.ts index e8496d7..8f83c61 100644 --- a/src/folder-note.ts +++ b/src/folder-note.ts @@ -243,9 +243,11 @@ export class FolderNote { // expand content template async expandContent(template: string) { - // keyword: {{FOLDER_NAME}} + // keyword: {{FOLDER_NAME}}, {{FOLDER_PATH}} var folderName = this.folderPath.split('/').pop(); - var content = template.replace('{{FOLDER_NAME}}', folderName); + var content = template + .replace(/{{FOLDER_NAME}}/g, folderName) + .replace(/{{FOLDER_PATH}}/g, this.folderPath) // keyword: {{FOLDER_BRIEF}} if (content.contains('{{FOLDER_BRIEF}}')) { let folderBrief = new FolderBrief(this.app); diff --git a/versions.json b/versions.json index 80490d4..8d53090 100644 --- a/versions.json +++ b/versions.json @@ -11,5 +11,6 @@ "0.6.4": "0.9.7", "0.6.5": "0.9.7", "0.6.6": "0.9.7", - "0.7.0": "0.10.13" + "0.7.0": "0.10.13", + "0.7.1": "0.10.13" }